Correctly using forms

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi all,

I come from a VB6 background and noticed that one cannot simply load forms
the way we used to.

What is the best way to code using multiple forms within one's ppc
application?

Any pointers to reading material will help greatly.

Thanks and regards
John.
 
John,

'---------------------------------------------------------------------
'
' for a typical OK / Cancel form
'

Form1 frm1 = new Form() ' creates the new form object
If frm1.ShowDialog() = DialogResult.OK Then ' ShowDialog() opens the
dialog
' Code if the user clicked on OK
Else
' Code if the user clicked on Cancel
EndIf


'---------------------------------------------------------------------
'
' in the Form1 "OK" button click event
'

DialogResult = DialogResult.OK ' sets the ShowDialog to return with OK and
closes this dialog


'---------------------------------------------------------------------
'
' in the Form1 "Cancel" button click event
'

DialogResult = DialogResult.Cancel ' sets the ShowDialog to return with OK
and closes this dialog



'---------------------------------------------------------------------


If you're not bothered about the result the dialog returns, then just call
Close() in the dialog to return from ShowDialog().

Does that answer you're question?

Dan.
 
Back
Top