Message Board


Message Board > Visual Basic > I made this for the government.

December 9, 2010, 22:11
toco123
Banned
240 posts

Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim weightlimit As Double = 100
        Dim cheeseInput As Boolean = True
        Dim cheese As String
        Dim weight As Double
        Dim biggest As Double
        Dim bigname As String

        cheese = InputBox("1 Blue" + vbNewLine + "2 Brie" + vbNewLine + "3 Chedder" + vbNewLine + "4 Edam" + vbNewLine + "5 Feta" + vbNewLine + "6 Gorganzola" + vbNewLine + "7 Quit", "Input cheese")

        Do Until cheese = "7"
            If cheese = "1" Then
                cheese = "Blue"
            ElseIf cheese = "2" Then
                cheese = "Brie"
            ElseIf cheese = "3" Then
                cheese = "Cheedar"
            ElseIf cheese = "4" Then
                cheese = "Edam"
            ElseIf cheese = "5" Then
                cheese = "Feta"
            ElseIf cheese = "6" Then
                cheese = "Gorganzola"
            Else : cheeseInput = False
            End If
            If cheeseInput = True Then
                Try
                    weight = CDbl(InputBox("Enter weight of cheese", "Input Cheese Weight"))
                Catch ex As Exception
                    Continue Do
                End Try
                If weight >= weightlimit Then
                    CheeseList.Items.Add(cheese)
                    WeightList.Items.Add(weight)
                    If weight >= biggest Then
                        biggest = weight
                        bigname = cheese
                        PopularBox.Text = bigname
                    End If
                End If
            End If
            cheese = InputBox("1 Blue" + vbNewLine + "2 Brie" + vbNewLine + "3 Chedder" + vbNewLine + "4 Edam" + vbNewLine + "5 Feta" + vbNewLine + "6 Gorganzola" + vbNewLine + "7 Quit", "Input cheese")
        Loop



    End Sub
End Class

____________
Kamasutra: The new Massively Multiplayer Foreplaying Game
#
December 9, 2010, 22:16
toco123
Banned
240 posts

Warp Gate is just eldars to a beat
____________
Kamasutra: The new Massively Multiplayer Foreplaying Game
#
January 3, 2011, 17:39
Dennis
どこかにいる
2097 posts

I like the way you handle exceptions from user input. Reminds me of soemthing I often see in PL/SQL

PL/SQL code:
DECLARE
  v_shit dual.dummy%TYPE;
BEGIN
  SELECT dummy
  INTO v_shit
  FROM dual;

  raise_application_error('FAIL',-20001); -- error gets caught
END;
EXCEPTION
  WHEN OTHERS THEN
    NULL;

____________
Kwakkel
#
March 1, 2011, 22:55
Zosma
Senior Procrastinator
99 posts

Hey Dennis.

What government?

PWN
____________
Fuck a duck
#
May 20, 2011, 10:17
Dennis
どこかにいる
2097 posts

Quoting Zosma:
Hey Dennis.

What government?

PWN


There still isn't one. :)
Almost a year! :)
A guiness record :)

:thumbs:
____________
Kwakkel
#
June 29, 2011, 15:33
Zosma
Senior Procrastinator
99 posts

Hehe :-)
____________
Fuck a duck
#
June 29, 2011, 16:40
Dennis
どこかにいる
2097 posts

I hate this country. I wish I lived in the Netherlands. They also have more facilities, unions and help for people who have a (physical) handicap.
____________
Kwakkel
#
September 22, 2023, 21:26
Dennis
どこかにいる
2097 posts

Quoting Dennis:
I hate this country. I wish I lived in the Netherlands. They also have more facilities, unions and help for people who have a (physical) handicap.


I used to be such an idiot.
____________
Kwakkel
#

Message Board > Visual Basic > I made this for the government.

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!