MessageBox form type

  • Thread starter Thread starter Mystique
  • Start date Start date
M

Mystique

How can i show some form/dialog without declaring "new myForm()"
like the MessageBox form
ex:
MessageBox.Show("bla bla bla");

i want the same for my form:
myForm.Show();
 
Create a static method called Show inside the Form. Then inside the static
Show method create an instance of the Form can call it's ShowDialog method.
 
Hello,

if you want to use the same instance, declare it one time as a field.

ex :
public class mainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
...
private newForm testForm = new newForm();
....

//everywhere in the code
testForm .Show();
....
}

Note : it is always the same instance.

Steph
 
* "Mystique said:
How can i show some form/dialog without declaring "new myForm()"
like the MessageBox form
ex:
MessageBox.Show("bla bla bla");

i want the same for my form:
myForm.Show();

In your class:

\\\
Public Shared Function Show() As ...
 
I just want to thank u guys, the static method with declaring new myForm in
in the method worked :-)
thanks
 

Ask a Question

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.

Ask a Question

Back
Top