Bonjour,
je veux charger une image pendant que la fenetre d'authentification essay de conncter a la base de donnée, j'ai fais comme suit:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
 
 private void button4_Click(object sender, EventArgs e)
        {
           pictureBox2.Visible = true;
 
 oleconnexion = "Provider=SQLNCLI.1;Data Source=DI05\\;Integrated Security=SSPI;Initial Catalog=COM";
 
 
            if (pictureBox2.Visible == true)
            {
                try
                {
 
oleDbConnection1.ConnectionString = oleconnexion;
this.oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM CONT ";
dataSet1.Clear();
oleDbDataAdapter1.Fill(this.dataSet1.Tables["CONTRAT"]).ToString();
string s = (string)dataSet1.Tables["COT"].Rows[0]["CONT"];
 
 
 
 
                    if (s.CompareTo("") != 0)
                    {  Form1 f2 = new Form1();
                        f2.Show(this);
                        this.Hide();
                    }
 
 
                }
 catch (System.Data.OleDb.OleDbException exp)
{ Cursor = System.Windows.Forms.Cursors.Default; MessageBox.Show("Mot de passe erroné", "Erreur d'accès à la base", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 
            }
 
 
        }
Je veux afficher l'image des que je click sur ok, mais l'image apparait apres le message box derreur de connection a la base de donnée, malgré que l'instruction d'affichage est avant le try, merci beaucoup