![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 49
Rep Power: 0
![]() |
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![]() |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
And what is the problem?
|
|
|
|
|
|
#3 | |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 648
Rep Power: 4
![]() |
Quote:
He posted this in the finished projects section...
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS! |
|
|
|
|
|
|
#4 | |
|
Programmer
Join Date: Oct 2005
Posts: 49
Rep Power: 0
![]() |
Quote:
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. ![]() |
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 6
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|