In a Windows Form, you need to create a custom dialog to show the prompt and
allow input. If you just want a simple MessageBox, try
System.Windows.Forms.MessageBox.Show()
private void button1_Click(object sender, System.EventArgs e)
{
Form2 f2 = new Form2();
if (f2.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(f2.PW);
}
}
on Form2 (prompt/dialog form)
public string PW
{
get
{
return textBox1.Text;
}
}
On Form2 set the DialogResult properties of your buttons to the
appropriate values (OK, Cancel, etc.) so they set the ShowDialog()
return value and close the close the form.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.