I am using System.Windows.Forms
but strangely enough don\'t have the ability to create them.
How can I get something like a javascript prompt dialog, wi
Other way of doing this: Assuming that you have a TextBox input type, Create a Form, and have the textbox value as a public property.
public partial class TextPrompt : Form
{
public string Value
{
get { return tbText.Text.Trim(); }
}
public TextPrompt(string promptInstructions)
{
InitializeComponent();
lblPromptText.Text = promptInstructions;
}
private void BtnSubmitText_Click(object sender, EventArgs e)
{
Close();
}
private void TextPrompt_Load(object sender, EventArgs e)
{
CenterToParent();
}
}
In the main form, this will be the code:
var t = new TextPrompt(this, "Type the name of the settings file:");
t.ShowDialog()
;
This way, the code looks cleaner: