bonjour

j'ai un problème je fais une propriété de liste pour acceder a cette liste dans le formulaire2 mais j'obtenue l'erreur suivant

Accès inégal: type de bien »System.Collections.Generic.List <WindowsFormsApplication1.Client> 'est moins accessible que la propriété

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
public partial class Form1 : Form
 {
        List<Client> _ListCient= new List<Client>();
        Client C;
        public int pos = 0;
        public int cher;
 
        public List<Client> ListCient
        {
            get { return _ListCient; }
            set { _ListCient = value; }
        }
 
public partial class Form2 : Form
 {
     public Form2()
     {
        InitializeComponent();
     }
 
private void OK_Click(object sender, EventArgs e)
       {
           Form1 F1 = (Form1)this.Owner;
 
           F1.cher =  int.Parse(textBox1.Text);
           this.Close();
 
 
           bool t = false;
 
foreach (Client client in F1.ListCiente)
{
   if (client.NumReglement == F1.cher)
   {         
        t = true;
      textBox1.Text = client.NumReglement.ToString();
      F1.textbox2 = client.NomClient;
   }
  if (t == false)
    MessageBox.Show("ce numero de regement n'existe pas");
 
}