Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 24th, 2005, 4:30 PM   #1
D-Ferg27
Programmer
 
D-Ferg27's Avatar
 
Join Date: Oct 2005
Posts: 49
Rep Power: 0 D-Ferg27 is on a distinguished road
Random # vb

hi guys

Today in my CP class we were making random # generator(or atleast learning) The only thing that i don't like is that when we learn stuff he gives us the code instead of letting us figure it out(he only makes us do it by ourselves on assignments). Just so it wouldn't be exactly the same i added some color to it . It works pretty good. haven't found any bugs in it yet. The only thing is is when you want a Rnd it comes out as a decimal but he said that its ok it that happens. Im still playing around with it but here it is:

Private Sub cmdExit_Click()
End
End Sub

Private Sub Form_Load()
'Randomize Timer
End Sub

Private Sub cmdGenerate_Click()
Dim rNum As Single
Dim iNum As Integer
If optRnd Then
    rNum = Rnd
    lblRandom.FontSize = 20
    lblRandom.BackColor = vbRed
    lblRandom.ForeColor = vbBlack
    lblRandom.Caption = rNum
ElseIf opt1to10 Then
    iNum = Int(Rnd * 10) + 1
    lblRandom.FontSize = 100
    lblRandom.BackColor = vbGreen
    lblRandom.ForeColor = vbRed
    lblRandom.Caption = iNum
Else
    iNum = Int(Rnd * 100) + 1
    lblRandom.FontSize = 80
    lblRandom.BackColor = vbBlue
    lblRandom.ForeColor = vbYellow
    lblRandom.Caption = iNum
End If
End Sub

D-Ferg27 is offline   Reply With Quote
Old Oct 24th, 2005, 4:54 PM   #2
ivan
Professional Programmer
 
ivan's Avatar
 
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4 ivan is on a distinguished road
And what is the problem?
ivan is offline   Reply With Quote
Old Oct 24th, 2005, 7:52 PM   #3
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 648
Rep Power: 4 Jessehk is on a distinguished road
Quote:
Originally Posted by ivan
And what is the problem?
None.

He posted this in the finished projects section...
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Oct 24th, 2005, 8:50 PM   #4
D-Ferg27
Programmer
 
D-Ferg27's Avatar
 
Join Date: Oct 2005
Posts: 49
Rep Power: 0 D-Ferg27 is on a distinguished road
Lightbulb

Quote:
Originally Posted by Jessehk
None.

He posted this in the finished projects section...

yea there is no problem. I really have nothing to mod here other than make a better color scheme. The only thing that i did with the color sheme since my original app that i posted obove was.....

Private Sub form_Load()
'Randomize Timer
Form1.BackColor = vbGrey
fraMain.BackColor = vbGreen
lblTitle.BackColor = vbGreen
optRnd.BackColor = vbGreen
opt1to10.BackColor = vbGreen
opt1to100.BackColor = vbGreen
End Sub

thats the best color scheme that ive experimented with so far. I could turn it into a guessing game for extra credit but im not sure. I already know what code i need to add but i rather just wait until we learn more complex code that i could use to enhance my idea.

Boy the possibilities associated with computer programming.
D-Ferg27 is offline   Reply With Quote
Old Oct 25th, 2005, 12:35 AM   #5
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 6 bl00dninja is on a distinguished road
yeah, i created a true random number generator one time except it was purple so i deleted it.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:21 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC