using inputboxes

genu

Well-known member
Joined
Jun 9, 2005
Messages
94
Programming Experience
1-3
How do you have more than one textbox in a the inputbox function...if its possible.

like have:

Name:
Age:
favorite color:


in just one inputbox popup
 
It is not possible. Create your own form and then display it by calling ShowDialog. This makes it behave the same way as a MessageBox, down to the fact that it returns a DialogResult to tell you which button was pressed. You then get the text boxes' contents via either properties of the form that you create (my preferred method) or directly from the text boxes if they have been declared public or friend.
 
Custom InputBox

This is just improvising on how Custom InputBox could look like. Take a look at the attached project.

For the rest of you:

1st make a routine that should pass the values to the new form (inputBox with 3 fields).

it should look like it follows:

PHP:
PrivateSub inBox(ByVal txt AsString, ByVal ttl AsString, ByVal field1 AsString, ByVal field2 AsString, ByVal field3 AsString)
  
Dim f AsNew InputBoxForm
 
f.lblText.Text = txt
 
f.Text = ttl
 
f.txt1.Text = field1
 
f.txt2.Text = field2
 
f.txt3.Text = field3
 
f.ShowDialog()
 
Me.txtName.Text = f.txt1.Text
 
Me.txtAge.Text = f.txt2.Text
 
Me.txtColor.Text = f.txt3.Text
 
EndSub
In the inputBox form you reffer to the form1 ...

PHP:
PrivateSub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
  
Dim f2 AsNew Form1
 
f2.txtName.Text = Me.txt1.Text
 
f2.txtAge.Text = Me.txt2.Text
 
f2.txtColor.Text = Me.txt3.Text
 
Me.Close()
 
EndSub


Cheers ;)


 

Attachments

  • PromtpDialog.zip
    34.3 KB · Views: 59
Back
Top