ShowDialog with arguments?

oggmorg

Member
Joined
Jan 25, 2012
Messages
16
Programming Experience
1-3
Hi, i have a console application, and a form prompt within the same project, i would like to call the form from the console with arguments.. im having some trouble. heres how im trying-

client = "TESTCLIENT"
user = "THISUSER"
lockprompt.ShowDialog(client, user)

i get the error-
Error 1 Overload resolution failed because no accessible 'ShowDialog' accepts this number of arguments.

can anyone help??
Thanks
 
You can overload that function and add the parameters if you wish:
    Public Overloads Function ShowDialog(client As String, user As String) As DialogResult
        'use arguments
        Return Me.ShowDialog()
    End Function

i have a console application, and a form prompt within the same project, i would like to call the form from the console with arguments..
That is not a good idea. Console applications is supposed to work from console only.
 
You can overload that function and add the parameters if you wish:
    Public Overloads Function ShowDialog(client As String, user As String) As DialogResult
        'use arguments
        Return Me.ShowDialog()
    End Function


That is not a good idea. Console applications is supposed to work from console only.

sorry it is a form application, that runs without any dialogue (only when required). excellent! that works! many thanks
 
Thread moved to Windows Forms forum.
how would i return values to the main??
ShowDialog method can only return a DialogResult value. Dialogs typically returns values with properties. This is an example for ColorDialog that has a Color property:
    If MyDialog.ShowDialog() = DialogResult.OK Then
        Dim selected As Color = MyDialog.Color
    End If
 
Thread moved to Windows Forms forum.

ShowDialog method can only return a DialogResult value. Dialogs typically returns values with properties. This is an example for ColorDialog that has a Color property:
    If MyDialog.ShowDialog() = DialogResult.OK Then
        TextBox1.ForeColor = MyDialog.Color
    End If

thanks for this!
 
Back
Top