6 Replies - 323 Views - Last Post: 08 May 2013 - 12:36 PM Rate Topic: -----

#1 kggr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 08-May 13

Question forloop

Posted 08 May 2013 - 11:24 AM

Public Class test
    Dim count As Integer


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        txtOne.Text = count
        count = count - 1

    End Sub
End Class


How can create something like this by using a forloop?
Is This A Good Question/Topic? 0
  • +

Replies To: Question forloop

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,467
  • Joined: 12-June 08

Re: Question forloop

Posted 08 May 2013 - 11:30 AM

That doesn't make sense. You have an event method in a class.. what part of that do you want in a for-loop?
Was This Post Helpful? 0
  • +
  • -

#3 kggr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 08-May 13

Re: Question forloop

Posted 08 May 2013 - 11:33 AM

Sry i forgot to add something on line 2
Dim count As Integer = 5



I want to countdown with a forloop.
txtOne.Text should go from 5 to 0.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,467
  • Joined: 12-June 08

Re: Question forloop

Posted 08 May 2013 - 11:36 AM

Okay.. so why not wrap setting the text box as such?

you do know when you kick off the for loop it will run faster than you probably will like.. so it won't be a leisurely count down with an updated UI to see all the numbers.
Was This Post Helpful? 0
  • +
  • -

#5 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1043
  • View blog
  • Posts: 4,057
  • Joined: 02-July 08

Re: Question forloop

Posted 08 May 2013 - 12:08 PM

A timer would work better in this instance. A simple loop would be too fast.
Was This Post Helpful? 0
  • +
  • -

#6 kggr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 08-May 13

Re: Question forloop

Posted 08 May 2013 - 12:31 PM

What i want is if user presses the button.
That the number should decrease by one.

I wanted to know if something like that is possible by using a forloop.
Was This Post Helpful? 0
  • +
  • -

#7 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Question forloop

Posted 08 May 2013 - 12:36 PM

You have the basis of that already. It's just you're decrementing by 1 instead of incrementing by 1.

What happens to a number when you subtract a value from it? how do you reverse that process?


Actually, I misread decrease as increase but now I can only ask if you've clicked that button a second time.

This post has been edited by CharlieMay: 08 May 2013 - 12:38 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1