Question Bug in webbrowser control, vb express 2010 (.net), can you confirm pls?

transactor

New member
Joined
Nov 3, 2010
Messages
4
Programming Experience
Beginner
Hello people, im using a WebBrowser control to auto fill a form in a page... i can access some properties of the <INPUT> html object, but when i try to set the Value property of this object VB fails and send me an error... i tried the SAME CODE in VB 6 and functions perfectly... CAN YOU CONFIRM THIS IMPORTANT BUG in the Webbroser control...

Im using VB NET EXPRESS 2010 (FREE EDITION)

CODE (PLEASE, MODIFY FOR YOUR CONVENIENCE):

PUT IN A FORM A WEBBROWSER CONTROL NAMED "WEB", AND BEFORE YOU DO CLICK IN THE PARENT FORM,NAVIGATE IT TO A SITE WITH A FORM. CHANGE THE .NAME PROPERTIE TO YOUR CONVENIENE

Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click

Dim Obj As Object

For Each Obj In Web.Document.All

If Obj.tagname = "INPUT" Then

Select Case Obj.name

Case Is = "uname" 'PLEASE CHANGE HERE THE NAME OF THE INPUT TARGET

MsgBox(Obj.tagname) ' IT FUNCTIONS!!!!

'But here dont, what da!!!!!!!!!!!!!!!!!!!!!!*************
Obj.Value = "asdfasasdfsjfdsfalfasfasdfasdlkjaslkfa"



End Select

End If

Next

End Sub
 
You can loop simpler .Document.GetElementsByTagName("input"), each item returned is type HtmlElement, then check Name property and use SetAttribute method to set the elements 'value' attribute.

Bug? VB6 was a bug.
 
how can i access the SetAttribute method? thanks

You can loop simpler .Document.GetElementsByTagName("input"), each item returned is type HtmlElement, then check Name property and use SetAttribute method to set the elements 'value' attribute.

Bug? VB6 was a bug.

thanks for your reply... it sounds reasonable... not to use the = assignmente process, but use a method... but...

how can i access the SetAttribute method?

thanks
 
thank you so much!! it functions with SetAttribute!

but WHAT THE HECK Microsoft continue with his culture of being the thins MORE complicated, expensive and resource consuming!!!!!

In VB6, it was so easy to use:

obj.value = "new stuff"

Back to basics...

Thanks
 
There are pros and cons to everything, SetAttribute method has benefits that a Value property doesn't have. Various html elements may have many different attributes, but not all has a Value attribute - HtmlElement class works for them all. SetAttribute is easy to use too :)
 
There are pros and cons to everything, SetAttribute method has benefits that a Value property doesn't have. Various html elements may have many different attributes, but not all has a Value attribute - HtmlElement class works for them all. SetAttribute is easy to use too :)

IM not agree, because we could be able to simple use the VALUE property to assign some value to it...

I dont want two way of doing the same thing, i need the more efficient way to do it...

thanks for your help this forums are valuable
 
I dont want two way of doing the same thing, i need the more efficient way to do it...
Exactly my point with the last post, both HtmlElement class and its SetAttribute methods are one for alls.
 
Back
Top