C
COHENMARVIN
I was told on this forum that a good way to display dialog boxes is
with the following code:
using (MyDialog myDialog = new MyDialog())
{
if (myDialog.ShowDialog(this) == DialogResult.OK)
{
someValue = myDialog.SomeValue;
}
}
Now I notice that when I create a Visual C# project, it comes with a
Form called "Form1", and a
program class that has a routine such as:
static void Main()
{
Application.Run(new Form1());
}
Is this "Form1" a modal dialog or a modeless form?
Also, if it is a dialog, then where can I fit in the code sample with
the "using" statement. The dialog is called within "Application Run",
and so there seems to be no room for a "using" statement.
Finally, if the dialog has a textbox called "TextBox1", I notice that
the Textbox is declared as being "private". Do I have to declare it
as "public" to be able to use code such as was shown above
(someValue= MyDialog.TextBox1.Text?
(what I mean is that I am getting a value from the dialog after the
dialog has been closed by the user, but before the 'using' statement
goes out of scope.)
Thanks
-- Marvin
with the following code:
using (MyDialog myDialog = new MyDialog())
{
if (myDialog.ShowDialog(this) == DialogResult.OK)
{
someValue = myDialog.SomeValue;
}
}
Now I notice that when I create a Visual C# project, it comes with a
Form called "Form1", and a
program class that has a routine such as:
static void Main()
{
Application.Run(new Form1());
}
Is this "Form1" a modal dialog or a modeless form?
Also, if it is a dialog, then where can I fit in the code sample with
the "using" statement. The dialog is called within "Application Run",
and so there seems to be no room for a "using" statement.
Finally, if the dialog has a textbox called "TextBox1", I notice that
the Textbox is declared as being "private". Do I have to declare it
as "public" to be able to use code such as was shown above
(someValue= MyDialog.TextBox1.Text?
(what I mean is that I am getting a value from the dialog after the
dialog has been closed by the user, but before the 'using' statement
goes out of scope.)
Thanks
-- Marvin