public void add(ref int itemcount) { Initial n1 = new Initial(); Console.Write("Enter student's ID:"); agian : string id = Console.ReadLine(); if (!ID(id, int.Parse(id))) { goto agian; } int stnumber = int.Parse(id); Console.Write("Enter student's Age:"); Ask : int stage = int.Parse(Console.ReadLine()); if (!Age(ref stage)) { goto Ask; } Do: Console.Write("Enter student's Name:"); string stname = Console.ReadLine().ToString(); bool result = stname.All(x => char.IsLetter(x) || x == ' ' || x == '.'); if (result != true) { Console.Write("You have entered a wrong Name !! , Re"); goto Do; } Agan : Console.Write("Enter student's Sex(F or M):"); string sex = Console.ReadLine().ToUpper(); if (!(sex == "M" || sex == "F")) { Console.Write("You have entered wrong !! Re"); goto Agan; } Console.Write("Enter student's quizz1 score from 5:"); Ask1 : float quizz1 = float.Parse(Console.ReadLine()); if (!n1[quizz1, "quizz1"]) { goto Ask1; } Console.Write("Enter student's quizz2 score from 5:"); Ask2 : float quizz2 = float.Parse(Console.ReadLine()); if (!n1[quizz2, "quizz2"]) { goto Ask2; } Console.Write("Enter student's assigment score from 10:"); Ask3 : float assigment = float.Parse(Console.ReadLine()); if (!n1[assigment, "assigment"]) { goto Ask3; } Console.Write("Enter student's mid term score from 20:"); Ask4 : float midterm = float.Parse(Console.ReadLine()); if (!n1[midterm, "midterm"]) { goto Ask4; } Console.Write("Enter student's final score from 60:"); Ask5 : float final = float.Parse(Console.ReadLine()); if (!n1[final, "final"]) { goto Ask5; } float total = quizz1 + quizz2 + assigment + midterm + final; WriteFile(@"D:\project\test.doc", "\nStudent Number:(" + (itemcount + 1) + ")\nID: " + id + "\nName: " + stname + "\nsex: " + sex + "\nAge: " + stage + "\nQuizz1: " + quizz1 + "\nQuizz2: " + quizz2 + "\nassigment: " + assigment + "\nmidterm: " + midterm + "\nfinal: " + final + "\ntotal: " + total + "\n"); st[itemcount] = new student(stnumber, stage, stname, sex, quizz1, quizz2, assigment, midterm, final, total); itemcount++; }//end the added information