private void button5_Click(object sender, EventArgs e) { Mark_Attendance mark = new Mark_Attendance(); mark.Show(); this.Hide(); }
public void MarkAttendance(string semester) { StreamWriter writer = File.AppendText(path2); writer.AutoFlush = true; StreamReader reader = new StreamReader(path1); string s_record = reader.ReadToEnd(); reader.Close(); Mark_Attendance mark = new Mark_Attendance(); string[] Student_Array = s_record.Split('x').ToArray(); string ID, Name, Student_Info; //char status; int ID_Index, Name_Index, ending_index, std_count = 0;// labelPosition = 29; Label[] label = new Label[Student_Array.Length]; RadioButton[] radioPresent = new RadioButton[Student_Array.Length]; RadioButton[] radioAbsent = new RadioButton[Student_Array.Length]; for (int i = 0; i < Student_Array.Length; i++) { if (Student_Array[i].Contains("Semester: " + semester)) { ID_Index = Student_Array[i].IndexOf("01"); Name_Index = Student_Array[i].IndexOf("Student Name: "); ID = Student_Array[i].Substring(ID_Index + 1, Name_Index - 1); ending_index = Student_Array[i].IndexOf('\n', Name_Index); Name = Student_Array[i].Substring(Name_Index, ending_index); Student_Info = ID + Name; std_count++; //label[i]=new Label(); //label[i].Location = new Point(3, 80+labelPosition); //label[i].Text =std_count + ". " + Student_Info; //label[i].Font = new Font("Calibry", 12); //label[i].Parent = mark.panel2; //label[i].Visible = true; //label[i].Show(); //radioPresent[i] = new RadioButton(); //radioPresent[i].Text = "Present"; //radioPresent[i].Location = new Point(305, 82+labelPosition); //radioPresent[i].Parent = mark.panel2; //radioPresent[i].Visible = true; //radioPresent[i].Show(); //radioAbsent[i] = new RadioButton(); //radioAbsent[i].Text = "Absent"; //radioAbsent[i].Location = new Point(372, 82 + labelPosition); //radioAbsent[i].Parent = mark.panel2; //radioAbsent[i].Visible = true; //radioAbsent[i].Show(); //labelPosition += 29; //status = Convert.ToChar(Console.ReadLine()); //Console.WriteLine(); //writer.WriteLine("Semester: " + semester); //writer.Write(Student_Info); //writer.WriteLine("Attendance: " + status); //writer.WriteLine("Date: " + DateTime.Now); //writer.WriteLine("x"); } } writer.Close(); }