HelpLabel Problem

Posts 1–5 of 5 · Page 1 of 1
Label Problem
Hey guys,

Im a complete noob with VB, now what i am trying to do is make the label increase its value as i click a button, so if i click it...it will be 1, again 2 etc...

Here is my coding so far:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ready.Click
If btn_Ready.Enabled Then
lbl_wave.Text = lbl_wave.Text += 1
End If
End Sub

Then i get an "End of statement expected"

Would be greatly appreciate some help

Thanks
Quote Originally Posted by nikolai13 View Post
Hey guys,

Im a complete noob with VB, now what i am trying to do is make the label increase its value as i click a button, so if i click it...it will be 1, again 2 etc...

Here is my coding so far:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ready.Click
If btn_Ready.Enabled Then
lbl_wave.Text = lbl_wave.Text += 1
End If
End Sub

Then i get an "End of statement expected"

Would be greatly appreciate some help

Thanks
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ready.Click
lbl_wave.Text += 1
End Sub
or

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ready.Click
lbl_wave.Text = lbl_wave.Text += 1
End Sub
or

Code:
Dim i as integer = 0

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ready.Click
i+=1
lbl_wave.Text = i
End Sub
Checking if the button is enabled is not necessary, the user won't click the button if it is not enabled.

lbl_wave.Text = lbl_wave.Text += 1 is not possible. The second part actually isn't.

lbl_wave.Text = lbl_wave.Text + 1 IS possible.
This works...thankyou
Blubb already said the simple code.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ready.Click
lbl_wave.Text += 1
End Sub

This should really work.
Quote Originally Posted by nathanael890 View Post
Blubb already said the simple code.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ready.Click
lbl_wave.Text += 1
End Sub

This should really work.
I edited my previous post, it works, just copied to code wrong
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us