WordTechinc
Programmer
- Sep 4, 2009
- 38
FORM1 need to get result from FORM2 and keep run next step in FORM1. So I used .showdialog() instead of .show(). The problem is I get result from FORM2 but looks like FORM2 still running. FORM2 looks like hide. How to end FORM2 after .showdialog()? I am a beginner. I read article about dislogresult. I didn't understand how this works. It says create Button(is this command button?) on Form2 for DialogResult. How to do it? How this works between FORM1 and FORM2.
from FORM1;
If dtJobDetailsMileRadius.Rows.Count > 0 Then
If objFrmMileRadius.Visible = False Then
objFrmMileRadius.Dispose()
objFrmMileRadius = New FrmMileRadius(txtJobNo.Text.Trim)
End If
objFrmMileRadius.ShowInTaskbar = True
objFrmMileRadius.dtMileRadiusLocations = dtJobDetailsMileRadius
objFrmMileRadius.ShowDialog()
objFrmMileRadius.Visible = False
objFrmMileRadius.Enabled = False
objFrmMileRadius.ShowInTaskbar = False
objFrmMileRadius.Dispose()
objFrmMileRadius.Close()
Else
CMDSMsgBox("No MileRadius method exist in job details.")
End If
If BoResetFlagMRind = True Then
Call Sub1
Call Sub2
End if
FORM2;
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click, cmdFormClose.Click
If BoRadiusFlagMRind = True Then
BoResetFlagMRind = True
Me.Dispose()
Else
BoResetFlagMRind = False
End If
Me.Close()
End Sub
from FORM1;
If dtJobDetailsMileRadius.Rows.Count > 0 Then
If objFrmMileRadius.Visible = False Then
objFrmMileRadius.Dispose()
objFrmMileRadius = New FrmMileRadius(txtJobNo.Text.Trim)
End If
objFrmMileRadius.ShowInTaskbar = True
objFrmMileRadius.dtMileRadiusLocations = dtJobDetailsMileRadius
objFrmMileRadius.ShowDialog()
objFrmMileRadius.Visible = False
objFrmMileRadius.Enabled = False
objFrmMileRadius.ShowInTaskbar = False
objFrmMileRadius.Dispose()
objFrmMileRadius.Close()
Else
CMDSMsgBox("No MileRadius method exist in job details.")
End If
If BoResetFlagMRind = True Then
Call Sub1
Call Sub2
End if
FORM2;
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click, cmdFormClose.Click
If BoRadiusFlagMRind = True Then
BoResetFlagMRind = True
Me.Dispose()
Else
BoResetFlagMRind = False
End If
Me.Close()
End Sub