For Next Loop

Displaying the counter in a textbox

Page 1 of 1

9 Replies - 1050 Views - Last Post: 11 September 2009 - 02:18 PM Rate Topic: -----

#1 wgpwgp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-December 08

For Next Loop

Post icon  Posted 11 September 2009 - 10:03 AM

My code is thes:

for x = 1 to 100
textbox1.text = x
next

Even with a delay loop only the upper limit(100) shows in the texbox.
what am I doing wrong?
Is This A Good Question/Topic? 0
  • +

Replies To: For Next Loop

#2 Jay93  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 93
  • Joined: 04-August 09

Re: For Next Loop

Posted 11 September 2009 - 10:06 AM

What are you using as a delay loop?
Was This Post Helpful? 0
  • +
  • -

#3 wgpwgp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-December 08

Re: For Next Loop

Posted 11 September 2009 - 10:38 AM

View PostJay93, on 11 Sep, 2009 - 09:06 AM, said:

What are you using as a delay loop?

for y = 1 to 500
next y

still only shows upper limit(100)
thanks
Was This Post Helpful? 0
  • +
  • -

#4 mark.bottomley  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 176
  • View blog
  • Posts: 990
  • Joined: 22-April 09

Re: For Next Loop

Posted 11 September 2009 - 10:44 AM

Did you change to TextBox.Text = y???

Delays can be busy loops, like counting to 1,000,000, or Thread.Sleep(500) which sleeps the thread for 500 milliseconds (half a second)
Was This Post Helpful? 0
  • +
  • -

#5 wgpwgp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-December 08

Re: For Next Loop

Posted 11 September 2009 - 11:11 AM

View Postmark.bottomley, on 11 Sep, 2009 - 09:44 AM, said:

Did you change to TextBox.Text = y???

Delays can be busy loops, like counting to 1,000,000, or Thread.Sleep(500) which sleeps the thread for 500 milliseconds (half a second)


Let me be more specific,
As an old basic programmer from the 80's it was a kick seeing numbers in a for next loop scrolling across the screen in a milisecond,
for x = 1 to 100
print x
next x
switching to visual basic has been painfull, but I'am finally getting it, execpt for this:
for x = 1 to 100
textbox1.text = x
next

still only shows the upper limit(100)
I know I'am missing really basic even if I won't use this loop.
Was This Post Helpful? 0
  • +
  • -

#6 Rayk8301  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 71
  • Joined: 09-January 09

Re: For Next Loop

Posted 11 September 2009 - 12:21 PM

I believe you can use the sort function inside the loop to do what you want it to do.
Was This Post Helpful? 0
  • +
  • -

#7 Yaroslav94  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 294
  • Joined: 15-July 09

Re: For Next Loop

Posted 11 September 2009 - 12:45 PM

Hey,

Try this???

  Dim Num As Integer = 0

	For i = 0 To 100 - 1 Step 1 'even know step 1 isn't necessary
			Num = Num + 1
			Console.WriteLine(Num)
		Next


Was This Post Helpful? 0
  • +
  • -

#8 mark.bottomley  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 176
  • View blog
  • Posts: 990
  • Joined: 22-April 09

Re: For Next Loop

Posted 11 September 2009 - 01:08 PM

80's - VB1/2/3 - 33MHz 386 - crap for a video card - interpreted Basic with slow operation.
Now - VB.Net - 3GHz Pentium - more power in graphics card than main CPU - JIT'd (Just-In-Time compiled) code, optimized. The 100 digits are appearing, but faster than the 60-120Hz video refresh - blink faster!
Was This Post Helpful? 0
  • +
  • -

#9 wgpwgp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-December 08

Re: For Next Loop

Posted 11 September 2009 - 02:08 PM

View Postmark.bottomley, on 11 Sep, 2009 - 12:08 PM, said:

80's - VB1/2/3 - 33MHz 386 - crap for a video card - interpreted Basic with slow operation.
Now - VB.Net - 3GHz Pentium - more power in graphics card than main CPU - JIT'd (Just-In-Time compiled) code, optimized. The 100 digits are appearing, but faster than the 60-120Hz video refresh - blink faster!

Mark,
thought that might be the case,
but when your my age it's hard to blink faster.
I didn't anyone even rembered a 33Mhz 386.
thanks for your time.
wgp
Was This Post Helpful? 0
  • +
  • -

#10 mark.bottomley  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 176
  • View blog
  • Posts: 990
  • Joined: 22-April 09

Re: For Next Loop

Posted 11 September 2009 - 02:18 PM

I have my original IBM PC in the basement - 4.77 MHz and needed a bios upgrade to support the EGA card and 10MB hard disk. I can also find my old Timex ZX81 if necessary. This was long after I stopped using punch cards and Fortran.... those were the days :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1