private void AddCarAgreeButt_Click(object sender, EventArgs e) { string platNum = PlatNumbertxt.Text; string Ccolor = Colortxt.Text; string Cyear = Yeartxt.Text; string Cmodel = Modeltxt.Text; string Cdriverid = Driveridtxt.Text; car Ca = new car(platNum, Ccolor, Cyear, Cmodel, Cdriverid); cars.Add(Ca); CarResultlbl.Text = "Car Add Successfully :)"; CarResultlbl.ForeColor = Color.Green; }
public void readcars(List <car> ca) { string outputs; string[] output; FileStream fs = new FileStream("cars.txt", FileMode.Open); StreamReader sr = new StreamReader(fs); while (sr.Peek() != -1) { outputs = sr.ReadLine(); output = outputs.Split('@'); car c = new car(output[0], output[1], output[2], output[3], output[4]); ca.Add(c); } sr.Close(); }
public void add_car(string platNum, string Ccolor, string Cyear, string Cmodel, string Cdriverid, car c, List <car> Ca) { car C = new car(platNum, Ccolor, Cyear, Cmodel, Cdriverid); Ca.Add(C); }