Author Topic: My VB Assignment  (Read 4990 times)

0 Members and 1 Guest are viewing this topic.

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
My VB Assignment
« on: March 25, 2007 »
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.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: My VB Assignment
« Reply #1 on: March 25, 2007 »
Not bad for a first attempt. Works well. k+.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: My VB Assignment
« Reply #2 on: March 25, 2007 »
Wtf? :) Where is the exe?
I found a whole load of folders and eventually found an exe file that would not run :(
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: My VB Assignment
« Reply #3 on: March 25, 2007 »
search for WindowsApplication1.exe

Nice first go in VB
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: My VB Assignment
« Reply #4 on: March 25, 2007 »
Thanks, I'll have to run it on the other comp :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: My VB Assignment
« Reply #5 on: March 25, 2007 »
You'll need to have .Net installed for this since it is VB.Net.

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: My VB Assignment
« Reply #6 on: March 26, 2007 »
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!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: My VB Assignment
« Reply #7 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???
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: My VB Assignment
« Reply #8 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.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: My VB Assignment
« Reply #9 on: March 26, 2007 »
Thanks Rick, that's why it wouldn't work for me :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: My VB Assignment
« Reply #10 on: March 29, 2007 »
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.

Code: [Select]
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.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: My VB Assignment
« Reply #11 on: March 29, 2007 »
Looks good.