Create a new form with a textbox on it and two buttons, add a readonly public property to this form, lets say call it UserInput, in its getter, have it return textbox1.text. On the buttons write OK and Cancel, and set their dialog result to OK and Cancel respectively. In the form's AcceptButton property, point it to your OK button, and the CancelButton property to your cancel button respectively.
From your main page, reference your "input dialog" such as:
- Dim oMyInputDlg As New frmInputDialog
-
If oMyInputDlg.ShowDialog(Me) = DialogResult.OK Then
-
Dim Output As STring = oMyInputDlg.UserInput
-
End If
-
oMyInputDlg.Dispose
Oops, missed your request for C# - in which case do everything the same for the setup, but the reference would look like:
- frmInputDialog oMyInputDlg = new frmInputDialog;
-
if (oMyInputDlg.ShowDialog(this) == DialogResult.OK){
-
string Output = oMyInputDlg.UserInput;
-
}
-
oMyInputDlg.Dispose;