|
-
May 8th, 2002, 07:28 PM
#1
Thread Starter
Lively Member
Help with IIF Condition
I want to get a number between 65 and 90 (ascii A-Z) I'm using the following but it aint working.
VB Code:
For z = 1 To 4
Randomize
Num = Round(Rnd * 218 + Rnd * 2, 0)
blncontinue = True
While blncontinue = True
Cool = Num
If Cool < 65 And Not Cool > 90 Then 'This is where I need help please
Randomize
Num = Round(Rnd * 218 + Rnd * 2, 0)
Else
blncontinue = False
End If
Wend
randomString = randomString & Chr(Num)
Next z
-
May 8th, 2002, 07:31 PM
#2
Why not:
Num = Round(Rnd * (90 - 65)) + 65
?
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
May 8th, 2002, 07:35 PM
#3
Thread Starter
Lively Member
yes that would work fine, I didn't know how to do it that way, never thought of it. Thank you
-
May 8th, 2002, 08:02 PM
#4
Addicted Member
Re: Help with IIF Condition
Originally posted by Nigorr
[B] If Cool < 65 And Not Cool > 90 Then 'This is where I need help please
If you look at your logic there, it doesn't quite make sense. Read it out loud
If cool is LESS THAN 65 AND Cool is NOT GREATER THAN 90 then blah blah blah...
I would imagine what you originhally wanted was
VB Code:
if cool >65 and cool <=90 then blah blah blah
In other words if cool is GREATER than 65 AND cool is LESS THAN OR EQUAL TO 95 then blah blah blah
Hope this helps with your original logic.
Pigmy
Remember - The light at the end of the tunnel could well be an on-coming train !
-
May 8th, 2002, 08:04 PM
#5
Thread Starter
Lively Member
Pigmy: That is what I originally had but it didn't work.... Kept getting other stuff
-
May 8th, 2002, 08:06 PM
#6
Thread Starter
Lively Member
no no I see where I went wrong I had what I wanted done in the wrong spot ie, generate the new number should have been in the else bit while exit the loop should have been in the do this bit.
-
May 8th, 2002, 08:08 PM
#7
Addicted Member
Originally posted by Nigorr
no no I see where I went wrong I had what I wanted done in the wrong spot ie, generate the new number should have been in the else bit while exit the loop should have been in the do this bit.
I find that when you have complicated if...then's that sometimes it's worth putting a "breakpont" in the code and when running it seeing where the IDE stops. That way you know the 'flow' that's running in your app.
Anyway, glad you got it sorted!!!!
Pigmy
Remember - The light at the end of the tunnel could well be an on-coming train !
-
May 8th, 2002, 08:35 PM
#8
The picture isn't missing
IF and IIF (1 I vs 2 I's) are different. in case you didnt know, or maybe it ws a typo.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
May 8th, 2002, 08:35 PM
#9
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|