"object instance not set to an instance of an object vb.net" happens when switch form
i have these 2 lines of code causing problem "object instance not set to an instance of an object vb.net" :
i have frmStart, frm1, and frm2.
In frmStart, i have a btnStart contains code: frm1.show, me.hide
In frm1, i have the code above to be executed when itself is shown. when first time the btnStart is clicked, the code in frm1 execute fine. also on frm1 i have btnGoToFrm2 which contains code frm2.show, me.hide
In frm2, i have a btnReturn contains code: frm1.show, me.hide. when i click on btnReturn, frm2 is hide and frm1 is shown.
Now if i click on btnGoToFrm2 on frm1 again, a message shows: "object instance not set to an instance of an object vb.net". beside this message, everything will still work as expected.
I located the error source, which is the code on the top. Can anyone help plz?
btw, the DsGetAllQs and SqlDataAdapterGetAllQs are visually dropped on to frm2 in design view
i have these 2 lines of code causing problem "object instance not set to an instance of an object vb.net" :
VB.NET:
dim frm2 as new frm2
frm2.DsGetAllQs.Clear()
frm2.SqlDataAdapterGetAllQs.Fill(frm2.DsGetAllQs)
i have frmStart, frm1, and frm2.
In frmStart, i have a btnStart contains code: frm1.show, me.hide
In frm1, i have the code above to be executed when itself is shown. when first time the btnStart is clicked, the code in frm1 execute fine. also on frm1 i have btnGoToFrm2 which contains code frm2.show, me.hide
In frm2, i have a btnReturn contains code: frm1.show, me.hide. when i click on btnReturn, frm2 is hide and frm1 is shown.
Now if i click on btnGoToFrm2 on frm1 again, a message shows: "object instance not set to an instance of an object vb.net". beside this message, everything will still work as expected.
I located the error source, which is the code on the top. Can anyone help plz?
btw, the DsGetAllQs and SqlDataAdapterGetAllQs are visually dropped on to frm2 in design view