Why do I get an error while filling the Form values, if the Form object was created with arguments?
The error is:
Reference to non-shared member needs an object reference.
File ParentForm.vb
Public Class Maincls
Dim oChildForm as New ChildForm("abc") ' Causes an error, but removing the arguments removes the error
Dim oChildForm as New ChildForm ' Does not throw an error
Public Sub btnok_click
ChildForm.tbXYZ.Text = "abc" ' Reference to non-shared member needs an object reference
End Sub
End Class
File ChildForm.vb
Public Class ChildForm
Public Sub New(tempString as String)
InitializeComponent()
End Sub
End Class
In the handler for btnok you are using the class name rather than the name of the instance you have created. This should do it.