M
Matteo Cima
Hi,
i need to show a modal form with a list of choices and when the user hits
ok, the form should close and return the selected value. I tried in many
ways but i can't say it's "elegant" enough... any ideas?
in the form (frmList) i create:
public string ShowDialogFormAndReturnValue()
{
// do some stuff
this.showdialog();
return iReturn;
}
iReturn is a private form's variable that is valorized when the user selects
the item...
when i want to use it i do:
frmList myForm = new frmList();
string myReturnValue = myForm.ShowDialogAndReturnValue();
where should i close the form?
i'd love to have the form close itself when returning the result... but
can't get that!
now i have to add myForm.Dispose() after the previous code...
any ideas?
regards,
Matteo.
i need to show a modal form with a list of choices and when the user hits
ok, the form should close and return the selected value. I tried in many
ways but i can't say it's "elegant" enough... any ideas?
in the form (frmList) i create:
public string ShowDialogFormAndReturnValue()
{
// do some stuff
this.showdialog();
return iReturn;
}
iReturn is a private form's variable that is valorized when the user selects
the item...
when i want to use it i do:
frmList myForm = new frmList();
string myReturnValue = myForm.ShowDialogAndReturnValue();
where should i close the form?
i'd love to have the form close itself when returning the result... but
can't get that!
now i have to add myForm.Dispose() after the previous code...
any ideas?
regards,
Matteo.