officemanager2
Technical User
Currently I'm in the early stages of using Visual Studio after working in Access. This code is an exercise to make me better at writing code.
When I run this I get an Invalid Cast Exception
Following the error messages I see is says conversions from string to integer is not valid
Unfortunately I cannot see where the code is trying to make this conversion?
The error seems to be based around
but at this point I cannot figure out what is going wrong. If I would guess I would say that I need a method after IntTotal whereas I believe I currently have it set as a property.
thanks
When I run this I get an Invalid Cast Exception
Following the error messages I see is says conversions from string to integer is not valid
Unfortunately I cannot see where the code is trying to make this conversion?
Code:
Private Sub Complete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Complete.Click
Dim CurrentAmount As Integer
Dim Split1 As Integer
Dim Split2 As Integer
Dim RemainOrg As Integer
Dim Total As Integer
CurrentAmount = IntCurAmt.Text
Split1 = IntSplit1.Text
Split2 = IntSplit2.Text
RemainOrg = IntRemainOrg.Text
Total = IntTotal.Text
Total = Split1 + Split2 + RemainOrg
IntTotal.Text = Total
If Total <> CurrentAmount Then
MsgBox("The Total is Incorrect")
Else
MsgBox("The Total is Correct")
End If
The error seems to be based around
Code:
Total = IntTotal.Text
but at this point I cannot figure out what is going wrong. If I would guess I would say that I need a method after IntTotal whereas I believe I currently have it set as a property.
thanks