VB.NET Try Catch block issues -


the program need complete focusing on try catch blocks. problem having error message shown every time user tries input anything, valid numeric data. i've been trying figure out past few hours, maybe can see mistake...

private sub calculatebutton_click(byval sender system.object, byval e system.eventargs) handles calculatebutton.click     'convert input values numeric variables.     dim snowboardinteger, withbootsinteger, totalinteger integer      try         'convert snowboard numeric variable.         snowboardinteger = integer.parse(snowboardstextbox.text)          try             'convert boots if snowboard sucessful.             withbootsinteger = integer.parse(withbootspricetextbox.text)              'calculate total price.             totalinteger = snowboardinteger + withbootsinteger              'calculate summary values.             snowboardsuminteger += snowboardinteger             withbootssuminteger += withbootsinteger             totalsuminteger += totalsuminteger             salecountinteger += 1             averageinteger = totalsuminteger / salecountinteger              'format , display price values.             snowboardspricetextbox.text = snowboardinteger.tostring("c")             withbootspricetextbox.text = withbootsinteger.tostring("c")             totalpricetextbox.text = totalinteger.tostring("c")              'format , display summary values.             snowboardrentaltextbox.text = snowboardsuminteger.tostring()             withbootsrentaltextbox.text = withbootssuminteger.tostring()             totalchargestextbox.text = totalsuminteger.tostring()             averagechargetextbox.text = averageinteger.tostring()          catch snowboards formatexception             'handle snowboard exception.             messagebox.show("snowboards value must numeric.", "data entry error", messageboxbuttons.ok, messageboxicon.error)             snowboardstextbox                 .focus()                 .selectall()             end         end try      catch withboots formatexception         'handle boots exception.         messagebox.show("snowboards boots value must numeric.", "data entry error", messageboxbuttons.ok, messageboxicon.error)         withbootstextbox             .focus()             .selectall()         end      catch anexception exception         'handle other exceptions.         messagebox.show("error: " & anexception.message)     end try end sub 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -