hey guys im tring to list whats in my collection base but no output..

by the way is there a way to load info from TXT file in collectionBase?

by the way this is just a project

i have :

class ATM
public void AddClient(string ClientID, string Full, string Type, double Solde, double Nip)
        {
            double Cash = Convert.ToDouble(Solde);
            double NipA = Convert.ToDouble(Nip);
            Client myClient = new Client(ClientID, Full, Type, Cash, NipA);

            client.Add(myClient);
        }



        public string ListClient()
        {
            string resultC = "";
            for (int i = 0; i < client.Count; i++)
            {
                resultC += client[i].ToString();
            }
            return resultC;
        }



        and on my form:

        richTextBox1.Clear();
            richTextBox1.AppendText(ATM.ListClient());

         add client:

            double Nip = Convert.ToDouble(textBox3Nip.Text);
            double Cash = Convert.ToDouble(textBox5Solde.Text);


            ATM.AddClient(textBox4IDcompte.Text, textBox1Full.Text, listBox1.Text, Cash, Nip);

            it doesnt seem to save or it saves but can't list

Recommended Answers

All 4 Replies

You'll need to show the rest of your class(es).

class Atm
    {
        Clients client = new Clients();

        public void AddClient(string ClientID, string Full, string Type, double Solde, double Nip)
        {
            double Cash = Convert.ToDouble(Solde);
            double NipA = Convert.ToDouble(Nip);
            Client myClient = new Client(ClientID, Full, Type, Cash, NipA);

            client.Add(myClient);
        }



        public string ListClient()
        {
            string resultC = "";
            for (int i = 0; i < client.Count; i++)
            {
                resultC += client[i].ToString();
            }
            return resultC;
        }


        public string Listall()
        {
            string result = "";
            for (int i = 0; i < client.Count; i++)
            {
                result += client[i].ToString();
            }
            return result;
        }







    }
}

this is all the ATM class

Why are you converting Solde and Nip to double on line 7 and 8?
They are already of type double.
Just pass them to the constructor on line 9.
On line 15 did you try resultC += client[i].Full;?

Ya i noticed i had 2 class's that were the same and fegot to get and set...

thx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.