Visual Basic Programming Exception Problems

  • From: "Marvin Hunkin" <startrekcafe@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 9 Sep 2008 13:54:13 -0700

Hi.
well, doing a college subject, and doing the beginning visual basic programming 
book, using 2005, even though using visual basic.net 2008 express, jaws 9 
standard, and windows vista home premium.
now, doing a project where you  have a price for a bail cleark, and the 
despcription as callateral.
then you have a 10% discount, and then have the input as text boxes, then have 
the numbered amount and the discount, added, then displayed in text boxes, and 
use exception error trapping.
now, got the problem, either when i click the calculate button, jaws either 
crashes, or when i run it from windows explorer, and the bin / debugg, says i 
have a exception unhandler problem.
can any one point me to tracking down this problem?

will post my code below.

maybe copy and paste it run it in vb.net express 2008, and see what is the 
problem.
is, and how to fix it.
cheers Marvin.

ps: so far, this is the first time encounted this problem.
did not have the problem, when i was doing the main example from the chapter 3, 
programming in visual basic, from milspaw, and MaGraw Hill Publishing.

'Program:   Bond
'Programmer:    Marvin Hunkin
'Date:  Monday September 8 2008
'Description:   Calculate Bond Bail Amount of 10%
'Display Bail Amount, Description and Total Amount of Bail with a 10% added to 
the Amount.


Public Class bondForm



    'Constant

    Const Amount_Price_Decimal As Decimal = 0.1D






    Private Sub calculateButton_Click(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles calculateButton.Click


        'Calculate the price and percentage.

        Dim priceDecimal As Decimal
        Dim amountDecimal As Decimal
        Dim descriptionString As String
        Dim itemDescription As String

        With Me
            'Convert values to Integer.

            Try

            Catch ex As Exception

                priceDecimal = Decimal.Parse(priceTextBox.Text)
                amountDecimal = Decimal.Parse(amountTextBox.Text)
                descriptionString = Integer.Parse(descriptionTextBox.Text)
                itemDescription = Integer.Parse(itemTextBox.Text)





                'Calculate values.


                priceDecimal = amountDecimal * Amount_Price_Decimal
                priceDecimal = priceDecimal - amountDecimal

            End Try


            Try
            Catch priceException As FormatException


                MessageBox.Show("Price must be numeric.", "Data Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)






            End Try


            Try


            Catch descriptionException As FormatException


                MessageBox.Show("Description must be text.", "Data Error", _
                                MessageBoxButtons.OK, 
MessageBoxIcon.Exclamation)


            End Try










            .priceTextBox.Text = priceDecimal.ToString("C")
            .descriptionTextBox.Text = descriptionString.ToString()
            .amountTextBox.Text = amountDecimal.ToString("C")
            .itemTextBox.Text = itemDescription.ToString()
        End With


        With priceTextBox()

            .Focus()
            .SelectAll()
            .Clear()


        End With















    End Sub

    Private Sub clearButton_Click(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles clearButton.Click


        'Clear Text Boxes.

        priceTextBox.Clear()
        amountTextBox.Clear()
        descriptionTextBox.Clear()

    End Sub

    Private Sub exitButton_Click(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles exitButton.Click


        'Exit the project.

        Me.Close()

    End Sub

    Private Sub itemTextBox_Click(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles itemTextBox.Click

    End Sub
End Class

Other related posts: