Any idea how to create "For" statement, so when you click to button it shows in textbox number - count number, so when you click it start from 1, then again when you click it shows in textbox number 2, etc.
Thanks for any idea... :)
Printable View
Any idea how to create "For" statement, so when you click to button it shows in textbox number - count number, so when you click it start from 1, then again when you click it shows in textbox number 2, etc.
Thanks for any idea... :)
Hi,
Can you please try and explain that one a little better and in a lot more detail, since I and many others on this Forum, know how to use and explain a For loop, but understanding your question totally confuses me.
Cheers,
Ian
You have one form with one button and one textbox. When you start application, textbox is empty, when you click on button, in textbox appears number 1, when you click again, then it shows number 2, etc. :)
Hi,
The first thing for you to realise is that what you are describing is NOT a For Loop. You are basically describing "How many times is a button pressed". To actually do this you would create a STATIC variable within your Button's Click event and then increment that variable each time the button was pressed. i.e:-Quote:
You have one form with one button and one textbox. When you start application, textbox is empty, when you click on button, in textbox appears number 1, when you click again, then it shows number 2, etc.
That said, and I could be mistaken, but is this what you are actually trying to achieve?Code:Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Static theNumberOfTimesMybuttonHasBeenPressed As Integer
theNumberOfTimesMybuttonHasBeenPressed += 1
MsgBox(theNumberOfTimesMybuttonHasBeenPressed.ToString)
End Sub
Hope that helps.
Cheers,
Ian
Yessss :bigyello:, thanks Ian