Hi Member 13209355,
I am assuming your first form name is
StaffAccountViewForm
, and second form name is
RoomBookingForm
.
you need to pass the
StaffAccountViewForm
instance as a parameter to the constructor of the
RoomBookingForm
. In the constructor you save the form instance to a local variable of the
RoomBookingForm
. So the following line:
Dim ExitedForm as Form
changes to:
dim ExitedForm As StaffAccountViewForm
In the constructor of this form:
Public Sub New(form1 As StaffAccountViewForm)
InitializeComponent() ' This call is required by the Windows Form Designer.
ExitedForm = form1
End Sub
The call from the
StaffAccountViewForm
changes to following:
Dim frm2 As RoomBookingForm = New RoomBookingForm(Me)
frm2.Show()
Hide()
Back button code is okay. Perhaps you would like to hide or close the second form. Hope this helps.