blah blah blah is here! blah blah » Close

up0down
link

Dear All,

Is it possible to make messagebox with text boxes and buttons (more than 1) so that we can receive inputs from the user with it?

Kindest Regards,




E

last answered one year ago

2 answers

link

Yeah sure it is.

What you want is to use something like

MessageBox.Show("some text", "text for the blue ribbon on top", MessageBoxButtons.okcancel);

messageboxbuttons.okcancel isn't the only one there, just type in the . after messageboxbuttons and pick one that intellisense will suggest.

Hope that helps!

Yes, but I mean is a messagebox with some text boxes. . . so for example 3 text boxes in which inside the text boxes we can put some value and then use the value

vulpes
17279

The standard MessageBox doesn't have a facility for the user to enter text though VB's InputBox, referred to below by Glen, does contain a single textbox. If you want more than this, then it's not difficult to design your own form which you can pop up (using ShowDialog) in place of the MessageBox. There are also quite a few custom MessageBoxes around if you search on sites such as Code Project.

up0down
link

You Mean like an Input box in VB6 (poss VB.Net never needed it). You can get the VB input box with

using System.Runtime.InteropServices;

// Text for box Title Initalvalue X, Y
StrUserName = Microsoft.VisualBasic.Interaction.InputBox("Enter Name", "Test Rig", "", 200, 150);

StrUserName is a String, you can use all sorts ints, floats. I have always found using seperate input boxes is better or easier, problem is if you need them to edit them may be a form could be used....
Glenn

Feedback