a.baldivia a.baldivia - 1 year ago 114
Vb.net Question

Showing numbers 1 to 70 in VB.Net 2010

I would like to ask if who knows how to show numbers 1 up tp 70 in label box every time I click the button?..to be specific my button is "NEXT" when I hit my Button "Next" automatic number 1 will show on my blank label box and when I hit again my button it will change in number 2 and so on...I Used this code in my button " Queue.Label1.Text = Queue.Label1.Text + 1 "...

Answer Source

Okay, first of all Label1.Text is a String. It will be problematic to you to perform math operations using a String.

You can try:

Queue.Label1.Text = Val(Queue.Label1.Text) + 1

Val() returns a numeric value.

Now, to limit it up to 70 only, you just have to put an if condition:

If Val(Queue.Label1.Text) <= 70 Then
     Queue.Label1.Text = Val(Queue.Label1.Text) + 1
End If
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download