[Help]Check Text

Posts 1–7 of 7 · Page 1 of 1
[Help]Check Text
Well In my program I need a timer1.tick that checks all the time a text of a webbrowser
Example :
In a wepage a label says Loading 1% .. 2% ...
I need in my program a label.text that contains the texts of label webrowser

thanks

And another Question I have a Progresbar and I want to

Code:
Try
            If WebBrowser1.Document.All("Sending-file").Enabled = True Then
                Label3.Text = "Sending"
            Else
                MsgBox("Error 1.1")
            End If
        Catch
        End Try
the time that is Enabled = True Progressbar1. start incrementing and when Enabled = False progresbar1 should be in Maximun value!
Never do time based progress, it's not going to be accurate. Time driven programming is always prone to errors and, as a general rule, shouldn't be used. What happens if a previous operation hangs up for an unexpectedly long amount of time, but you've just set a timer to execute the next step 5 seconds after the last operation? Your program will probably crash.

Always look to write event driven code where applicable, such as in this case. If you look at the WebBrowser's events there is an event called "ProgressChanged", sounds promising doesn't it!

[highlight=vb.net]
Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEven tArgs) Handles WebBrowser1.ProgressChanged

End Sub
[/highlight]

Generally in these types of sub procedures, the "e" variable contains most of the event information. Now, let's take a look at what kind of properties are available for "e"

Oh look:
[highlight=vb.net]
e.CurrentProgress
e.MaximumProgress
[/highlight]

Fancy that, the only two things you actually need. So just set your progressbar's maximum to e.MaximumProgress, then update it's value to whatever e.CurrentProgress is holding when the event is fired.
My VT Scanner whn You uplaod a file a scren of Uploaing file appears.. I have made this

Code:
 If WebBrowser1.Document.All("Sending-file").Enabled = True Then
            ProgressBar1.Increment(e.CurrentProgress)
            ProgressBar1.Maximum = e.MaximumProgress
        End If
Now I need to check the Uploading progress.. I think thats Difficult no? Uploading Progress :S
Quote Originally Posted by alvaritos View Post
My VT Scanner whn You uplaod a file a scren of Uploaing file appears.. I have made this

Code:
 If WebBrowser1.Document.All("Sending-file").Enabled = True Then
            ProgressBar1.Increment(e.CurrentProgress)
            ProgressBar1.Maximum = e.MaximumProgress
        End If
Now I need to check the Uploading progress.. I think thats Difficult no? Uploading Progress :S
You shouldn't be incrementing by e.CurrentProgress. e.CurrentProgress represents the total progress so far, not how much it has changed since the last event fired.

ProgressBar1.Value = e.CurrentProgress

I dunno about the uploading process, I haven't really thought about it too much
And how I make my Timer checks if a button in the webbrowser exists?
Just do like:
Code:
If Not WebBrowser1.Document.GetElementById("YourButtonID").InnerText = vbNullString Then
Msgbox("The button exists!")
Else
Msgbox("Try again, The button does not exist..")
End if
I think it work, Didn tested it..

or Make a try : catch...
Like:
Code:
Try
Msgbox("The button " & WebBrowser1.Document.GetElementById("YourButtonID").InnerText & " exists!")
Catch ex As Exception
Msgbox("The button does not exist!")
End Try
Well I've resolved using another method xD (Checking the Webrowser URL ) haha but thanks!
Solved!
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us