BobInIndy

Using VS05 SP1...

How do you create a new custom Windows.Forms.DialogResult for a button

I want to be able use some other DialogResult than the standard yes, no, cancel, etc.

I tried the obvious, like

Me.buttong_Clear_System_Settings.DialogResult = CType("Clear", Windows.Forms.DialogResult)

but Windows.Forms.DialogResult.Clear is not availablle (only the standard ones show).

I only want to use this in a specific form, and infact a specific method in the form, so a simple exmaple would be helpful.

Thanks!

Bob




Re: Visual Basic Language create a new custom Windows.Forms.DialogResult for a button

Dick Donny

Hi Bob

You can't directly change the enumeration and add a new member.

You could expose your own ShowDialog style method (that calls MyBase.ShowDialog itself) on the form and return your own value to the caller based on the result of MyBase.DialogResult

Richard

eg

Class Form1 : Inherits Form

Enum EDialogResults ...... Ok = DialogResult.Ok etc ... BespokeVal =

 

Sub ShowTheForm As EDialogResults ...

dim dr as dialogresult = mybase.showdialog

if not returnMyBespokeValue then return system.enum.parse(gettype(EDialogResult), dr.tostring) else return EDialogResult.BespokeVal etc