runtime error - NullReferenceException was unhandled on button_click [vb.net] -
runtime error - NullReferenceException was unhandled on button_click [vb.net] -
i have problem code. during debug mode, there no error or warning @ all. when pressed button, error comes up. code:
private sub button11_click_1(byval sender system.object, byval e system.eventargs) handles button11.click button1.enabled = true dim integer = 0 10 webbrowser1.document.getelementbyid("login").setattribute("value", (textbox1.text)) webbrowser1.document.getelementbyid("savebtn").invokemember("click") next end sub
you should, steve said in comments, utilize kind of error handling code...i.e try....catch method create sure valid in webbrowser. seek this
private sub button11_click_1(byval sender system.object, byval e system.eventargs) handles button11.click button1.enabled = true dim integer = 0 10 seek webbrowser1.document.getelementbyid("login").setattribute("value", (textbox1.text)) webbrowser1.document.getelementbyid("savebtn").invokemember("click") grab ex exception end seek next end sub
try...catch blocks methods observe problems. in case, lets few of command within loop returned null...by using method, can "ignore" these problems , move on next "i" without throwing exeption or dealing wrong texts etc.
vb.net runtime-error unhandled-exception
Comments
Post a Comment