Ok. Wasn't what I dreamed of. But, I guess it will have to do now!!!
Wish I could have programmed a scrolling star field... and a rotating cube! Wow... that would have blown my teacher away! haha
But, here it is.
Hope you enjoy. The code is messy - which will make my mark go down lol.
Not bad for a first attempt. Works well. k+.
Wtf? :) Where is the exe?
I found a whole load of folders and eventually found an exe file that would not run :(
search for WindowsApplication1.exe
Nice first go in VB
Thanks, I'll have to run it on the other comp :)
You'll need to have .Net installed for this since it is VB.Net.
Opps. Yea, VB makes a hell of a lot of folders and files for the program! Kinda a waste of space - but if you delete one of them, your whole program is ruined!!!
If you have VB 2005, you can click on the .SLN file. This opens it up through VB and you just run it.
Didn't know there was an .EXE...
Glad youse like it!
I ran the exe dirrect from winzip ???
so i suppose they might not be needed???
maybe the prog diddnt work as it should for me???
Quote from: Paul on March 26, 2007
I ran the exe dirrect from winzip ???
so i suppose they might not be needed???
maybe the prog diddnt work as it should for me???
You need to have .Net 2.0 installed on your computer before you can run the program.
Thanks Rick, that's why it wouldn't work for me :)
Wow. Had another assignment, and it's all done.
Pretty easy stuff. I thinbk this code is alot easier on the eyes, and I really like the lay out.
Public Class Form1
Public guess As Integer
Public range As Integer
Public winner As String
Public winner_guess As Integer
Public winner_range As Double
Public players As Integer
Public beans As Integer
Public random_bean As New Random
Public bean_min As Integer = 50
Public bean_max As Integer = 500
Public already_show As Integer
Public play As Integer
Private Sub btnWinner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWinner.Click
If already_show = 0 Then
If players > 0 Then
'Show Who Won: With Their Name and Guess, and Show the Actual Amount
lblWinner.Text = winner & " Wins with a Guess of " & winner_guess & "!"
lblBeans.Text = "There Are Actually " & beans & " Jelly Beans in the Jar."
txtName.Text = "press 'Play Again' to restart"
already_show = 1
Else
'If No Players Are Participating, then Tell the User
MessageBox.Show("Please Enter at Least One Guess!!!")
End If
Else
'Tell the User to Hit the Play Again Button to Restart
MessageBox.Show("Please Press the 'Play Again' Button to Restart.")
End If
End Sub
Public Sub calculate()
'Error Check for Guess Entry
If IsNumeric(txtGuess.Text) = False Then
MessageBox.Show("Please Enter a Valid Number.")
txtGuess.Focus()
Exit Sub
End If
'Read Guess from Text Box
guess = txtGuess.Text
'If Guess is too Low or too High, Get Another
If (guess < bean_min Or guess > bean_max) Then
MessageBox.Show("Please Enter a Value Between 51 and 499.")
play = 1
End If
If play = 0 Then
'Calculate Range of Guess
range = Math.Abs(beans - guess)
'If the Range is Lower than the Current Winning Range then Change Winner
If range < winner_range Then
winner = txtName.Text
winner_guess = guess
winner_range = range
End If
'Add the New Player
players = players + 1
lblPlayers.Text = players
'Ask to Add a New Player?
txtName.Text = "next please!"
txtGuess.Text = 0
End If
End Sub
Private Sub btnGuess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click
play = 0
'*already_show* is Used to See if the User Has Pressed the *Show Winner* Button
'If They Have, then Don't Calculate Winner, but Tell Them to Restart
If already_show = 0 Then
'Get Calculations to See Who is Winning
calculate()
Else
'Tell the User to Hit the Play Again Button to Restart
MessageBox.Show("Please Press the 'Play Again' Button to Restart.")
End If
End Sub
Private Sub btnFinished_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFinished.Click
End
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Default Winning Range. Set High so First Guess Gets Winning Spot
winner_range = 999999999999999999
'Number of Beans in the Jar
beans = random_bean.Next(bean_min, bean_max)
End Sub
Private Sub btnAgain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAgain.Click
'Change Values Back to Default for New Game
players = 0
lblPlayers.Text = players
txtName.Text = "enter your name here"
txtGuess.Text = 0
winner_range = 999999999999999999
beans = random_bean.Next(bean_min, bean_max)
lblWinner.Text = ""
lblBeans.Text = ""
already_show = 0
End Sub
End Class
Enjoy. I've attatched the program.
Looks good.