Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

for... next loops

Status
Not open for further replies.

Jerred

MIS
Mar 1, 2005
3
0
0
US
this code makes a table(looks like a calendar) and then adds numbers in rows and columns. right now it goes from 1 to 42
my question is: is there a way i can make it stop adding at say 31?

dim test as string
test = "<table BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=590><tr><td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td></tr>"
dim intcounter as integer
dim intcounter2 as integer
dim i as integer
i = 1

for intcounter = 1 to 6
test = test & "<tr>"

for intcounter2 = 1 to 7
test = test + "<td>" & i & "</td>"
i = i + 1
next

next
lbltable.text = test
 
You could use the following in your loops

Code:
If i = 31 then exit for

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top