You can invoke a function on the form that returns a value, and in the
function do a me.showdialog(). Like this:
'to invoke this class, do this: X = SelectDatabase.PromptUser
' X will be the returned ConnectionString.
'Return empty string if user clicks Cancel.
Public Function PromptUser() As String
Me.ShowDialog()
If (Me.DialogResult = Windows.Forms.DialogResult.OK) Then
My.Settings.DBConnString = CreateConnectionString("Y")
My.Settings.DatabaseName = DatabaseComboBox.Text
My.Settings.ServerName = ServerTextBox.Text
My.Settings.Save()
Return DatabaseComboBox.Text
Else
Return String.Empty
End If
End Function
Robin S.
--------------------------
"iwdu15" <jmmgoalsteratyahoodotcomwrote in message
news:15**********************************@microsof t.com...
hi, im attempting to create an intellisense type form and have hit a
roadblock. I need the form to return (like the ShowDialog method returns
the
dialog result) the value that was selected when the form closes. however,
i
cannot just create a method that shadows ShowDialog and return it that
way
because the form needs to close when the user clicks elsewhere on the
screen,
or Alt-Tabs away from the window. i already have the code to close the
window
when the user clicks or aalt-tabs away, but how can i have the form
return a
result when this occurs? thanks
--
-iwdu15