Re: VB. Net String conversion Exception Hanlder message

  • From: "Ricks Place" <OFBGMail@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 28 Sep 2008 08:31:51 -0400

Hi Marv:
Just send the Error Message and the line of code, or short code block, related to the message for help please.
Rick USA
----- Original Message ----- From: "Marvin Hunkin" <startrekcafe@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, September 28, 2008 8:02 AM
Subject: VB. Net String conversion Exception Hanlder message


Hi.
now, for my finance project, got an exception error, and says some thing
about conversion string.
how can i fix this one, and if any one can help, would be appreciative. vb
programming book.
for my vb class.
if any one can help me out, and show me how to fix the problem, will go and
show you the code and the exception helper window.


'Program:   Finance
'Programmer:    Marvin Hunkin
'Date:  Tuesday September 9 2008
'Description: Enter beginning, ending and cost of living for a management
company.
'Calculate  the beginning, ending and cost of living, display the average
inventory,  and the turnover.


Public Class financeForm


   'Constant Declaration

   Const yearInteger As Integer = 365









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


       'Calculate Beginning Inventory, Ending Inventory and Cost Of Goods

       Dim beginDecimal As Decimal
       Dim endDecimal As Decimal
       Dim costDecimal As Decimal
       Dim averageDecimal As Decimal
       Dim turnoverInteger As Integer


       'Convert variables.

       With Me



           beginDecimal = Decimal.Parse(beginTextBox.Text)
           endDecimal = Decimal.Parse(endTextBox.Text)
           costDecimal = Decimal.Parse(costTextBox.Text)
           averageDecimal = Decimal.Parse(averageTextBox.Text)
           turnoverInteger = Integer.Parse(turnoverTextBox.Text)


           'Calculate Finance Details.







           averageDecimal = beginDecimal * endDecimal * costDecimal /
yearInteger
           turnoverInteger = beginDecimal * endDecimal / yearInteger


           Try




           Catch beginException As FormatException


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


           Catch endException As FormatException


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






           Catch costException As FormatException


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








               'Format Text Boxes.

               .beginTextBox.Text = beginDecimal.ToString("C")
               .endTextBox.Text = endDecimal.ToString("C")
               .costTextBox.Text = costDecimal.ToString("C")
               .averageTextBox.Text = averageDecimal.ToString("C")
               .turnoverTextBox.Text = turnoverInteger.ToString("N")


               With beginTextBox


                   .Focus()
                   .SelectAll()

               End With



           End Try


       End With




   End Sub

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



       'Clear Text boxes.

       beginTextBox.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
End Class


'Program:   Finance
'Programmer:    Marvin Hunkin
'Date:  Tuesday September 9 2008
'Description: Enter beginning, ending and cost of living for a management
company.
'Calculate  the beginning, ending and cost of living, display the average
inventory,  and the turnover.


Public Class financeForm


   'Constant Declaration

   Const yearInteger As Integer = 365









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


       'Calculate Beginning Inventory, Ending Inventory and Cost Of Goods

       Dim beginDecimal As Decimal
       Dim endDecimal As Decimal
       Dim costDecimal As Decimal
       Dim averageDecimal As Decimal
       Dim turnoverInteger As Integer


       'Convert variables.

       With Me



           beginDecimal = Decimal.Parse(beginTextBox.Text)
           endDecimal = Decimal.Parse(endTextBox.Text)
           costDecimal = Decimal.Parse(costTextBox.Text)
           averageDecimal = Decimal.Parse(averageTextBox.Text)
           turnoverInteger = Integer.Parse(turnoverTextBox.Text)


           'Calculate Finance Details.







           averageDecimal = beginDecimal * endDecimal * costDecimal /
yearInteger
           turnoverInteger = beginDecimal * endDecimal / yearInteger


           Try




           Catch beginException As FormatException


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


           Catch endException As FormatException


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






           Catch costException As FormatException


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








               'Format Text Boxes.

               .beginTextBox.Text = beginDecimal.ToString("C")
               .endTextBox.Text = endDecimal.ToString("C")
               .costTextBox.Text = costDecimal.ToString("C")
               .averageTextBox.Text = averageDecimal.ToString("C")
               .turnoverTextBox.Text = turnoverInteger.ToString("N")


               With beginTextBox


                   .Focus()
                   .SelectAll()

               End With



           End Try


       End With




   End Sub

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



       'Clear Text boxes.

       beginTextBox.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
End Class

graphic 94  Solution Explo... Data SourcetTextBox.Text)
averageTextBox.Text) Properties
(turnoverTextBox.Text) graphic 545
graphic 545
graphic 932
graphic 756  graphic 692



__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: