Bonjour,

J'ai un gros soucis mon formulaire ne fonctionne pas comme je veux. Voici mon code
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Security.Cryptography.X509Certificates;
using System.Net;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;
 
namespace Inf
{
    public partial class Inf : Form
    {
        //variables
        string name;
        string id;
 
        private String _XmlPathString = null;
        private String _WebPath = null;
 
        public Inf()
        {
            InitializeComponent();
 
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            Console.WriteLine("test");
            System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatesPolicy();
 
        }
 
        public class TrustAllCertificatesPolicy : System.Net.ICertificatePolicy
        {
 
            public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest req, int problem)
            {
                return true;
            }
        }
 
 
        //fonction qui creer le flux xml
        private static XmlNodeList MyGetChildNodes(String pPathString, String pPathXmlString)
        {
            // Crée XmlDocument
            XmlDocument doc = new XmlDocument();
            try
            {
                //load charge le document
                Application.DoEvents();// reprend la main sur le formulaire sinon ecran figer
                doc.Load(pPathString);
 
 
            }
            catch (Exception ex)
            {
 
                // MessageBox.Show(ex.Message);
 
            }
            return doc.SelectNodes(pPathXmlString);
 
 
        }
 
        private void Info(object sender, EventArgs e)
        {
            Application.DoEvents();// reprend la main sur le formulaire sinon ecran figer
 
            string bdd = ConfigurationManager.AppSettings["bdd"];// va chercher le nom de la base de donnée dans le fichier app.config
            string server = ConfigurationManager.AppSettings["server"];// va chercher le nom du serveur dans le fichier app.config
            string utilisateur = ConfigurationManager.AppSettings["utilisateur"]; // va chercher le nom de l'utilisateur dans le fichier app.config   
            string pwd = ConfigurationManager.AppSettings["pwd"]; // va chercher le mot de passe dans le fichier app.config
 
 
 
 
            string name_bis = name_complet;
            string code_client = "";
            string requete__idclient;
            string id_client = "";
 
                // Chaine de connexion
                string connectString = "database='" + bdd_idclient + "'; server= '" + server_idclient + "';User ID='" + utilisateur_idclient + "'; pwd='" + pwd_idclient + "'";
                // Objet connection
                SqlConnection connection = new SqlConnection(connectString);
 
                connection.Open();// Ouverture
 
 
                requete__id = "SELECT id FROM table where code = '" + code.Replace("'", "''") + "'";
                SqlCommand command = new SqlCommand(requete__id, connection);
                // Objet DataReader
                SqlDataReader reader = command.ExecuteReader();
 
                if (reader.Read())
                {
                    id = reader.GetString(0);
                }
                reader.Close();
 
                connection.Close();
 
 
 
        }
    }
}
Je voudrais savoir comment faire pour qu'une fois qu'il est aller dans InitializeComponent();
il parte faire ma requete dans private void Info