restrict number upto 7

 Dim tildays As Decimal = dateallreadybooked.counttilleft(Session("Username"))

        While tildays > 0
            DropDownList1.Items.Add(New ListItem(tildays, tildays))

            tildays -= 0.5
        End While

Open in new window


How would i edit the code so the drop down menu will only reach 7

so if tildays = 58 then it will only go upto 7

if till days = 5 it will still show only 5
runnerjp2005Asked:
Who is Participating?
 
käµfm³d 👽Connect With a Mentor Commented:
Actually, let me change that:

If tildays > 7 Then tildays = 7

While tildays > 0

Open in new window

0
 
käµfm³d 👽Commented:
While tildays > 0 AndAlso tildays <= 7

Open in new window

0
 
runnerjp2005Author Commented:
Thats great,,,, i would have never of thought of that logic!
0
 
käµfm³d 👽Commented:
NP. Glad to help  = )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.