M
Michael Johnson
Greetings,
Take the following example of a form and a form launched from within it.
Dim frmCredit as new frmCredit
frmCredit.showdialog()
Now, in the frmCredit, you have an OK box which does the saving of data,
cleanup, validation, etc.... On one of the validation checks (ensuring that
all required fields are entered) you have the following:
Private Sub cmdOK_click(ByVal sender as System.Object, ByVal e as
System.EventArgs) Handles cmdOK.Click
errorProvider(txtName,"")
if txtName.text.length=0 then
errorprovider.seterror(txtName, "Enter Name")
exit sub
end if
..........
End Sub
Problem: When this validation fails, when the exit sub is called, it closes
the entire form, rather than exiting just the cmdOK_Click event. This then
puts you back at the original form which would create, what I'd term as an
unpleasant user experience.
However, should you change the original call to: "frmCredit.Show()" when
the data validation fails and the exit sub is called, it returns to the
frmCredit as expected. What gives? Anybody work around this with the
showdialog? I'd like to use this call, as it is imperative and the
underlying form relies on the data that is input on the frmCredit.
Michael
Take the following example of a form and a form launched from within it.
Dim frmCredit as new frmCredit
frmCredit.showdialog()
Now, in the frmCredit, you have an OK box which does the saving of data,
cleanup, validation, etc.... On one of the validation checks (ensuring that
all required fields are entered) you have the following:
Private Sub cmdOK_click(ByVal sender as System.Object, ByVal e as
System.EventArgs) Handles cmdOK.Click
errorProvider(txtName,"")
if txtName.text.length=0 then
errorprovider.seterror(txtName, "Enter Name")
exit sub
end if
..........
End Sub
Problem: When this validation fails, when the exit sub is called, it closes
the entire form, rather than exiting just the cmdOK_Click event. This then
puts you back at the original form which would create, what I'd term as an
unpleasant user experience.
However, should you change the original call to: "frmCredit.Show()" when
the data validation fails and the exit sub is called, it returns to the
frmCredit as expected. What gives? Anybody work around this with the
showdialog? I'd like to use this call, as it is imperative and the
underlying form relies on the data that is input on the frmCredit.
Michael