how to include vb inputbox in VS2008

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xjackal
    New Member
    • Sep 2008
    • 2

    how to include vb inputbox in VS2008

    hi i want to include vb inputbox in VS2008.got any ideas?
  • xjackal
    New Member
    • Sep 2008
    • 2

    #2
    by the way im using C#.net

    Comment

    • balabaster
      Recognized Expert Contributor
      • Mar 2007
      • 798

      #3
      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:

      Code:
      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:

      Code:
      frmInputDialog oMyInputDlg = new frmInputDialog;
      if (oMyInputDlg.ShowDialog(this) == DialogResult.OK){
        string Output = oMyInputDlg.UserInput;
      }
      oMyInputDlg.Dispose;

      Comment

      Working...