How to display a TextBox control in a MessageBox?

Any idea how to display a textBox control in a MessageBox.

I am working on winjs projcet c #.

Thanks in advance.

+6
source share
8 answers

You can not. MessageBox is a special container designed only for displaying messages and buttons. Instead, you can create your own form with any controls you want and use .DisplayModal() on it.

+15
source

You can simply add an input window from VB.NET to your C # project. First add Microsoft.VisualBasic to the list of projects, then use the following code:

 string UserAnswer = Microsoft.VisualBasic.Interaction.InputBox("Your Message ", "Title", "Default Response"); 

And that should work properly.

+4
source

It’s better to add a new form to your application, which you can customize as you want.

and just name it where required.

+3
source

you can create a classic win form that looks like a message box and opens it as a modal form, possibly using Form.ShowDialog

more information on

http://msdn.microsoft.com/en-us/library/c7ykbedk.aspx

+1
source

As I know, there is no way to do this.

You can create a winform form-style to look like a MessageBox and add your own controls.

+1
source

You cannot configure MessageBox, the better you use the pop-up window developed using Windows Form separately, and use its instance to call.

 customPopup popup = new customPopup(); popup.ShowDialog(); 

Put your controls in a pop-up form and set public access modifiers if you want to access text fields or shortcuts, etc. in the previous form.

 customPopup popup = new customPopup(); popup.msgLabel.Text= "Your message"; popup.ShowDialog(); 
+1
source

Yes, as mentioned by the krillgar, you must create your own form. And also 1. Encapsulate the form in a static class or function, so you can just call MyMessageBox.Show (). 2. The text field should have readonly = true, so end users will not be able to change the displayed text, while they can select the text and copy to the clipboard.

With regard to paragraph 2, I believe that many applications for creating Windows and MS Office use this approach.

0
source

The solution is here, you can create a window shape and design it, set the dialog form, when you call the form, this is an auto show. In the form you create, you set the value of some static parameter when another class is in the project, but you must set when you close the form project, which, OK, return the init init call dialog box, you create the call interval when there is = = null return call, when! = null, you end the callback and use the parameter in the static class!

-1
source

Source: https://habr.com/ru/post/946079/


All Articles