Hi
this.webBrowser1.DocumentText = string.Format(html, "htp://youtu.be/faT7y8NiZ20".Split('=')[1]);
Thanks
Hi
this.webBrowser1.DocumentText = string.Format(html, "htp://youtu.be/faT7y8NiZ20".Split('=')[1]);
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ramco RamcoPosted Nov 15, 2022, 3:01 AM
Hi
On below line i am getting error - object reference not set to an instance of the object.
this.webBrowser1.DocumentText = string.Format(html, "htp:/www.youtube.com/watch?v=MYojqnJ34g4".Split('=')[1]);
Thanks
Ramco RamcoPosted Nov 14, 2022, 2:49 AM
Hi
It is giving error Object reference not set to an instance of the object.
Thanks
Gowtham RamarPosted Nov 12, 2022, 8:54 AM
Hi,
if ("htp://youtu.be/faT7y8NiZ20".Split('=').length>0){
this.webBrowser1.DocumentText = string.Format(html, "htp://youtu.be/faT7y8NiZ20".Split('=')[1]);
}
Sachin SinghPosted Nov 12, 2022, 8:27 AM
As, Sam sir said , clearly there is no '=' in your url so the split function is throwing the error. please modify your url.
generally the youtuble url is like this
www.youtube.com/watch?v=sS5BCvj6c_0
this url will work when you will split.
Sam HobbsPosted Nov 12, 2022, 7:10 AM
When you get an error like that you can split the code as in the following.
When you run that you will see that a[0] has the entire contents of html but a[1] does not exist and therefore it causes the error. There is no '=' in the input string.
Programmers prefer to do many things in one line of code but that can cause a problem when there is an error, it is more difficult to find the cause of the error.