Results 1 to 5 of 5

Thread: For statement

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2013
    Posts
    120

    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...

  2. #2
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2013
    Posts
    120

    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.

  4. #4
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2013
    Posts
    120

    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
  •  



Click Here to Expand Forum to Full Width