Salut,

Pour info, je fais un programme qui gère un hotel.

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
       BL.IBL bl;
        public AddClientForm(BL.IBL bl)
        {
            InitializeComponent();
            this.bl = bl;
        }
 
        private Client client()
        {
            return new Client
            {
                Client_id = int.Parse(ACF_clientid_textBox.Text),
                Client_firstname = ACF_fnclient_textBox.Text,
                Client_lastname = ACF_lnclient_textBox.Text,
                Client_tel = int.Parse(ACF_telclient_textBox.Text),
                Client_adress = ACF_adressclient_textBox.Text,
                Client_country = ACF_country_textBox.Text,
                Client_codepost = int.Parse(ACF_postcodeclient_textBox.Text),
                Client_mail = ACF_mailclient_textBox.Text,
                Client_passport = int.Parse(ACF_passportclient_textBox.Text),
                Client_visa = int.Parse(ACF_visaclient_textBox.Text)
            };
        }
 
private void ACF_add_button_Click(object sender, EventArgs e)
        {
           //try
           //{
                bl.add_client(client());
                MessageBox.Show("Client Added","Information",MessageBoxButtons.OK,MessageBoxIcon.Information);
                Close();
            //}
            //catch
            //{
              //  MessageBox.Show("Misses Information", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
        }
J'obtiens une erreur tel que la
La référence d'objet n'est pas définie à une instance d'un objet
et je ne comprend pas la raison.
Merci pour l'aide.