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 didn't closed. How to close Form2 after .showdialog()
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
FORM2;
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click, cmdFormClose.Click
If BoRadiusFlagMRind = True Then ' Dim ReSetFrmTraditionalAnalysis As New FrmTraditionalAnalysis
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
FORM2;
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click, cmdFormClose.Click
If BoRadiusFlagMRind = True Then ' Dim ReSetFrmTraditionalAnalysis As New FrmTraditionalAnalysis
BoResetFlagMRind = True
Me.Dispose()
Else
BoResetFlagMRind = False
End If
Me.Close()
End Sub