I'm doing a college student attendance project in the form of a win with MySQL (C #).
That I want to move the data from one list to another list. I have done it. But I load the student name into this. Now the client wants the name and adminno, like datagridview columns.
I am looking for this. Vb has this type of encoding. See List of Multiple Columns . Is this possible in C # ?.

See image below. Its my form ...

My code to download the list
MySqlConnection connection = new MySqlConnection(MyConString); MySqlCommand command = connection.CreateCommand(); MySqlDataReader Reader; command.CommandText = "select name,admin_no from student_admision_master where course='" + course_code + "' AND year='" + year_code + "' AND sem='" + semester_code + "' AND batch='" + batch_code + "'"; connection.Open(); Reader = command.ExecuteReader(); while (Reader.Read()) { listBox1.Items.Add(Reader[0].ToString() + "," + Reader[1].ToString()); } connection.Close();
This gives the result of jagadees, 125445. But you want to separate the individual columns.
My code to move data
private void btn_toAb_Click_Click(object sender, EventArgs e) { int count = listBox1.Items.Count; for (int i = 0; i < count; i++) { listBox2.Items.Add(listBox1.Items[i].ToString()); } listBox1.Items.Clear(); } private void btn_fromAb_Click_Click(object sender, EventArgs e) { int count = listBox2.Items.Count; for (int i = 0; i < count; i++) { listBox1.Items.Add(listBox2.Items[i].ToString()); } listBox2.Items.Clear(); } private void btn_toAb_Selected_Click(object sender, EventArgs e) { int count = listBox1.SelectedItems.Count; for (int i = 0; i < count; i++) { listBox2.Items.Add(listBox1.SelectedItems[i].ToString()); } for (int i = 0; i < count; i++) { listBox1.Items.Remove(listBox1.SelectedItems[0]);
Thanks in advance!...
source share