Example #1
0
        //  Making a Method to Display in Main
        public void CustomerDisplay()
        {
            StreamWriter In;

            try
            {
                In = File.AppendText("C:\\Users\\RON TAYLOR\\Desktop\\Computer Programing\\Customer_Information.txt");

                Console.WriteLine("please enter  customers number");
                customernumber = int.Parse(Console.ReadLine());
                Console.WriteLine("please enter customers name");
                customername = Console.ReadLine();
                Console.WriteLine("please enter  there address");
                address = Console.ReadLine();
                In.WriteLine(customernumber);
                In.WriteLine(customername);
                In.WriteLine(address);
                In.WriteLine("CUstomer number :{0} Customer name :{1} Customer address :{2}", customernumber, customername, address);
                In.Close();
            }
            catch
            {
                Console.WriteLine(" file not writtten ");
            }

            Console.ReadLine();

            StreamReader Fr;


            Fr          = File.OpenText("C:\\Users\\RON TAYLOR\\Desktop\\Computer Programing\\Customer_Information.txt");
            infodisplay = Fr.ReadLine();
            while (infodisplay != null)
            {
                Console.WriteLine(infodisplay);
                infodisplay = Fr.ReadLine();
            }

            Fr.Close();
        }