Hello,
I have built a form with 2 datagrids bound to a underlaying table; there are 3 tables in a dataset with the relations set up.
There is a combo box with some values extracted from one of the datagrids.
What i would like to do is pass the value from the combobox and open a new form.
I get a cast error saying that the variable passed is a double and should be an integer.
The error received is
Form a code
Form b constructor code
Not sure what is going wrong with this, if anyone can help it would be greatly appreciated
regards
James
I have built a form with 2 datagrids bound to a underlaying table; there are 3 tables in a dataset with the relations set up.
There is a combo box with some values extracted from one of the datagrids.
What i would like to do is pass the value from the combobox and open a new form.
I get a cast error saying that the variable passed is a double and should be an integer.
The error received is
Code:
Message is Object reference not set to an instance of an object.
Form a code
Code:
Dim EstNo As New Integer
Dim test As String
test = cmbEstNo.SelectedIndex.GetType.ToString
Dim StrMsg As String
StrMsg = "Confirmation of Value: EstNo " & test & ""
Dim response As MsgBoxResult
response = MsgBox(StrMsg, MsgBoxStyle.OKCancel)
If response = MsgBoxResult.OK Then
Try
' Show Main Form
'Dim test As New Form
' EitemsStock test = New EitemsStock(EstNo))
Dim Main As New EitemsStock(EstNo)
Main.Show()
Catch excNull As System.Exception
Console.WriteLine("Message is " & excNull.Message)
MsgBox("An Error has occurred. " & excNull.Message)
End Try
Else
MsgBox("Please Select Correct Value")
End If
End Sub
Form b constructor code
Code:
Public Sub New(ByVal EstNo As Integer)
MyBase.New()
Try
'Dim testint As Integer
'testint = EstNo
'MsgBox("The contents of the passed EstNo" + testint)
StatusBar1.Text = "Passed EstNo =" & EstNo
Catch ex As Exception
Console.WriteLine("Message is " & ex.Message)
StatusBar1.Text = "An Error has occurred. " & ex.Message
End Try
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
' constructor?
End Sub
Not sure what is going wrong with this, if anyone can help it would be greatly appreciated
regards
James