Pb de fonction ( static / non static )
Alors voilà mon prog :
2 windows forms
windows form1 avec plusieur fonction dont une qui s'appelle init_form
Code:
1 2 3 4 5 6 7
| public void init_form(int max)
{
Program.random_nb(max);
Dernier_coups.Text = "";
textBox1.Text = "";
Titre.Text = "Indiquez une valeur entre 1 et " + max;
} |
et une form2 qui a juste un bouton ressayer je voudrait que ce bouton ferme la form2 et lance la procédure init_form voila le code :
Code:
1 2 3 4 5 6 7
| private void button1_Click(object sender, EventArgs e)
{
int max1 = Program.max;
Form1.init_form(max1);
Close();
} |
j'ai une erreur du type :
Citation:
Erreur 1 Une référence d'objet est requise pour la propriété, la méthode ou le champ non statique 'WindowsApplication1.Form1.init_form(int)' C:\Documents and Settings\Luffy\Mes documents\Visual Studio 2005\Projects\tournoiCS\WindowsApplication1\Form2.cs 22 13 WindowsApplication1