returning a dialogresult

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
returning a dialogresult [Resolved]

using the open/save file dialog object's as an example

how do i have a form return a DialogResult when the form is closed?

basically i have a login form and when this form is closed i want either a DialogResult.Ok or DialoResult.Cancel returned when this form is closed
 
Last edited:
The form must have been called using ShowDialog. You simply set the form's DialogResult property to the desired value and when the current call stack completes the form will be dismissed and ShowDialog will return the value you set. Note I said that the form will be dismissed. The form is not Closed, so you can call Show or ShowDialog on it again. You can set the DialogResult property of any button on a form so that when that button is clicked the form's DialogResult property is set accordingly. Setting a form's DialogResult to anything but None will dismiss it. If ShowDialog is called again, the form's DialogResult property is reset to None.
 
gotcha thanx

i actually noticed that the ShowDialog is a function and i ended up overloading that function and having it return dialogresult.ok or dialogresult.cancel based on a boolean
 
Back
Top