Currently I am working with the ShowDialog()
method and trying to figure out how it is supposed to work. I have a form, testDialog, that has a text box that will take an input string. I followed the code on the MSDN page as follows:
string Range;
testDialog specRange = new testDialog();
if (specRange.ShowDialog(this) == DialogResult.OK)
{
Range = specRange.txtPageRange.Text;
}
else
{
Range = "";
}
specRange.Dispose();
The thing I can't find any information on and that I can't figure out is, how do I enter the text and get it to submit? I put buttons on the form but they didn't show up when I ran the program. I enter the text into the text box but I can't hit enter or anything, my only option is to close the form.
Is there something I'm missing that I need to add so that I can hit enter or click an Okay button after entering the text?
From msdn :
The simplest method to do that is to add a Button "Ok" to your testDialog and change its property DialogResult to Ok. So when you click on it, it will return DialogResult.ok and you will enter your if.