Looping character or number visual basic 6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #16
    Originally posted by Killer42
    Nope. :)

    But I'll tell you how you can do it. First of all, I'd recommend reversing the order of the DoEvents and the Text1.Text = j - but that's unrelated.

    Inside your loop, just code "if checkbox is not checked, escape from the loop". I'd prefer you do the translation from English to VB. It's fairly straightforward . Hint, you want to Exit from the For loop.

    Code:
    Dim intDisplay as integer
     
    Private Sub Timer1_Timer()
        If Check1.Value = 1 Then
            if intDisplay > 10000 then intDisplay = 99
            intDisplay = intDisplay + 1
            Text1.Text = intDisplay
        End if
    End Sub
     
    Private Sub Check1_Click()
        intDisplay = 100
    End Sub
    how about this code

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #17
      Originally posted by hariharanmca
      how about this code
      Yes, that looks like the other option I mentioned. Incrementing each time the timer event fires. For this you would want a pretty small timer interval.

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #18
        Originally posted by Killer42
        Yes, that looks like the other option I mentioned. Incrementing each time the timer event fires. For this you would want a pretty small timer interval.
        Yha, Whatever I mention above for properties.

        is that code working fine?

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #19
          I haven't had a chance to try it. But it looks alright.

          Comment

          • Ifoel
            New Member
            • Jul 2007
            • 12

            #20
            sorry hariharanmca..
            not work
            when looping run the resul text1.text =1
            just it... and stop and looping not run again even check1 value =1

            Comment

            • hariharanmca
              Top Contributor
              • Dec 2006
              • 1977

              #21
              Originally posted by Ifoel
              sorry hariharanmca..
              not work
              when looping run the resul text1.text =1
              just it... and stop and looping not run again even check1 value =1
              Code:
              Dim intDisplay as integer
               
              Private Sub Timer1_Timer()
                  If Check1.Value = 1 Then
                      if intDisplay > 10000 then intDisplay = 99
                      intDisplay = intDisplay + 1
                      Text1.Text = intDisplay
                  End if
              End Sub
               
              Private Sub Check1_Click()
                  intDisplay = 100
              End Sub

              Try this qode

              Comment

              Working...