Presumably you get a NullReferenceException on this line:when the first TextBox contains an ID that doesn't exist. The solution is simple and you have already been provided with it. Simply assign the result of GetElementById to a variable and then test whether that variable is Nothing. If it is then the ID doesn't exist so you don't call SettAttribute. If it's not then you call SetAttribute on the variable. ALWAYS look before you leap, i.e. test the data before you use it and only use it if it's valid. There are very few scenarios where you can't do so.Code:WebBrowser1.Document.GetElementById(inputidval.Text).SetAttribute("Value", inputidnew.Text)




Reply With Quote
