How to define own DialogResults?

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

Hello,

i have a form for different uses. So my form should have as DialogResult
'Button1', 'Button2' and so on instead of 'No', 'Yes' or other predefined
Results. Does anybody knows, how to define non-predefined DialogResults?

Thanks

Frank
 
Hi Frank,
i have a form for different uses. So my form should have as DialogResult
'Button1', 'Button2' and so on instead of 'No', 'Yes' or other predefined
Results. Does anybody knows, how to define non-predefined DialogResults?

"DialogResult" enumeration cannot be changed or extended.
But do you really need "ButtonX" names in it?
I think that you can use existing values e.g. Ignore (for Button1)
and Retry (for Button2).

Other solution for you:
1. Define own enumeration e.g. ClickedButtonEnum.
2. Add ClickedButtonEnum variable and "ClickedButton" property
(that returs this variable) in your form.
3. Set variable on a button click.
4. Get your enumeration value from Form's ClickedButton
property

HTH
Marcin
 
Back
Top