Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click WebBrowser1.DocumentText = Y_View(TextBox1.Text) End Sub Public Shared Function Y_View(ByVal y_adress As String) Dim change As String = Nothing Dim source As String = Nothing If y_adress.Contains("www.youtube.com/watch?v=") Then change = y_adress change = change.Replace("watch?v=", "embed/") change = change.Replace("\&.*\n", Nothing) If Regex.IsMatch(change, "\&") Then change = Regex.Replace(change, "\&.*", "") End If source = "<body style=""padding:0;margin:0;""><iframe width=""100%"" height=""100%"" src=""" & change & """ frameborder=""0"" allowfullscreen></iframe>" MsgBox(source) Else MsgBox("YouTubeの動画のアドレスを指定してください。", MsgBoxStyle.OkOnly, "エラー") End If Return source change = Nothing source = Nothing End Function