Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old February 8th, 2004, 02:55 PM
Draxiss Draxiss is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 4 Draxiss User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
VB6 compile error concerning random

I am tring to create a program that will generate 4 random numbers between 1 and 20 adding the highest three and adding 35 to the final value.

For some reason when I try to compile the program I get the following warning: Sub or Function undefined.

I would appreciate any help.

Code:
Private Sub strr_Click()
Randomize Timer
Text1.Text = Int(Rnd * 20) + 1
Text2.Text = Int(Rnd * 20) + 1
Text3.Text = Int(Rnd * 20) + 1
Text4.Text = Int(Rnd * 20) + 1

a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
d = Val(Text4.Text)


If (a > b) Then a = g1 & b = f1
eles b = g1 & a = f1
End If


If (c > d) Then c = g2 & d = f2
eles d = g2 & c = f2
End If

If (f1 > f2) Then f1 = g3
eles f2 = g3
End If

Reply With Quote
  #2  
Old February 8th, 2004, 10:08 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
Look at your Else. You have it as 'eles'...

If (f1 > f2) Then f1 = g3
eles f2 = g3
End If

Should be

If (f1 > f2) Then f1 = g3
Else f2 = g3
End If

Reply With Quote
  #3  
Old February 9th, 2004, 04:49 PM
Draxiss Draxiss is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 4 Draxiss User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
DOH, thanks for the good eeye bud.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > VB6 compile error concerning random


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway