JRV
JRV

Reputation: 33

Can't get program to read information in textbox

I'm having issues with visual basic when I try to get my program to read a line of output in a Textbox field.

Private Sub txtConsole_TextChanged(ByVal sender As System.Object, ByVal e As EventArgs)
    If (txtConsole.Text.Contains("[download] 100.0%")) Then
        ProgressBar1.Increment(100)
    End If
End Sub

I thought the code would allow the progress bar to appear at 100% once the "[download] 100.0%" appeared in the TextBox, but it doesn't work at all.

This program is a GUI for a command line only program and it passes commands from the GUI to that program. Currently, for the log, I'm using StreamOutput, but my knowledge with programming is very limited.

Upvotes: 0

Views: 62

Answers (1)

Visual Vincent
Visual Vincent

Reputation: 18310

You are missing the Handles clause:

Private Sub txtConsole_TextChanged(ByVal sender As System.Object, ByVal e As EventArgs) Handles txtConsole.TextChanged

Without it txtConsole_TextChanged is just a regular method. The Handles clause adds the method to the specified event's (in this case TextChanged) event handler list.

Upvotes: 1

Related Questions