|
-
May 4th, 2013, 07:49 AM
#1
Thread Starter
Lively Member
For statement
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...
-
May 4th, 2013, 08:14 AM
#2
Re: For statement
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
-
May 4th, 2013, 08:35 AM
#3
Thread Starter
Lively Member
Re: For statement
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.
-
May 4th, 2013, 10:18 AM
#4
Re: For statement
Hi,
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.
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:-
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
That said, and I could be mistaken, but is this what you are actually trying to achieve?
Hope that helps.
Cheers,
Ian
-
May 4th, 2013, 10:29 AM
#5
Thread Starter
Lively Member
Re: For statement
Yessss , thanks Ian
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|