asp.net vb --- for loop?

  • Thread starter Thread starter Jay W
  • Start date Start date
J

Jay W

Guest
i am trying to learn how to use the for loop and am really confused. im reading asp.net 3.5 and it gives me this code.

for loopcount as integer = 1 to 10
lbl1.text &= loopcount.tostring() & "< br />"
next

but where should i write this code..

i am using visual web developer 2008 express edition.
 
The code need to be in the code behind page for the webpage you want it to run\display on..

If you go to design view and double click on any blank part of the page it should take you there automatically (the page load event to be precise) you can simply put it in here then on load the page will execute this code.

You could also drag a button onto the page (again in design view) and double click the button which will take you to the onclick event for the button and again if you paste in the code in the code behind and run the page it will execute when you click the button!

Hope this helps!:)

*Edit don't forget the code references a label control on your webpage called lbl1 so make sure you have this on your page somewhere in design view otherwise it will error!:)
 
The code need to be in the code behind page for the webpage you want it to run\display on..

If you go to design view and double click on any blank part of the page it should take you there automatically (the page load event to be precise) you can simply put it in here then on load the page will execute this code.

You could also drag a button onto the page (again in design view) and double click the button which will take you to the onclick event for the button and again if you paste in the code in the code behind and run the page it will execute when you click the button!

Hope this helps!:)

*Edit don't forget the code references a label control on your webpage called lbl1 so make sure you have this on your page somewhere in design view otherwise it will error!:)
 
Back
Top