G
Guest
I have a parent form that launches its child form to a user to edit and
create input data for a parent form. Now, the problem is that after I closed
a child form and tried to call a routine of the parent form(class) to
redisplay and reflect the change I make, I got the error message "Object
reference not set to an instance of an object". Please see code below.
Private Sub ChildForm_Closed(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Closed
Dim ParentForm As MainConsole
On Error GoTo Whoops
'// LoadDataGrid routine is basically used to display/refresh the
data on DataGrid
ParentForm.LoadDataGrid()
Whoops:
MsgBox("Unexpected Error:" & Err.Description)
Return
End Sub
I understand ParentForm is not an active form, therefore its routine is not
visible to ChildForm(different class). But, I simply do not want to use
"New" to initialize another instance of ParentForm and then end up having two
duplicate forms displaying to a user: one with the old data and one with the
current data. Let's say if that's the only way to do, and I then still do
not know how to close the very first ParentForm and have only its most
current instance remain displayed. Could someone shed some light for me on
this, please? Thank you so much for your time and insight.
create input data for a parent form. Now, the problem is that after I closed
a child form and tried to call a routine of the parent form(class) to
redisplay and reflect the change I make, I got the error message "Object
reference not set to an instance of an object". Please see code below.
Private Sub ChildForm_Closed(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Closed
Dim ParentForm As MainConsole
On Error GoTo Whoops
'// LoadDataGrid routine is basically used to display/refresh the
data on DataGrid
ParentForm.LoadDataGrid()
Whoops:
MsgBox("Unexpected Error:" & Err.Description)
Return
End Sub
I understand ParentForm is not an active form, therefore its routine is not
visible to ChildForm(different class). But, I simply do not want to use
"New" to initialize another instance of ParentForm and then end up having two
duplicate forms displaying to a user: one with the old data and one with the
current data. Let's say if that's the only way to do, and I then still do
not know how to close the very first ParentForm and have only its most
current instance remain displayed. Could someone shed some light for me on
this, please? Thank you so much for your time and insight.