How Can i get Two column winform listbox in C#? -


i doing student attendance project college in win form mysql(c#).

in want move data 1 listbox listbox. done that. load student name in that. client want name , adminno datagridview columns.

i search this,. vb has type of coding. see multi column listbox. possible in c#?.

enter image description here

see below picture. form.,..

enter image description here

my code loading listbox

        mysqlconnection connection = new mysqlconnection(myconstring);         mysqlcommand command = connection.createcommand();         mysqldatareader reader;         command.commandtext = "select name,admin_no student_admision_master course='" + course_code + "' , year='" + year_code + "' , sem='" + semester_code + "' , batch='" + batch_code + "'";         connection.open();         reader = command.executereader();         while (reader.read())         {             listbox1.items.add(reader[0].tostring() + "," + reader[1].tostring());         }         connection.close(); 

this give result jagadees, 125445. want disparate separate columns.

my code moving data's

private void btn_toab_click_click(object sender, eventargs e) {     int count = listbox1.items.count;     (int = 0; < 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;     (int = 0; < 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;     (int = 0; < count; i++)     {         listbox2.items.add(listbox1.selecteditems[i].tostring());     }      (int = 0; < count; i++)     {         listbox1.items.remove(listbox1.selecteditems[0]);         //listbox1.add      } }  private void btn_fromab_selected_click(object sender, eventargs e) {     int count = listbox2.selecteditems.count;     (int = 0; < count; i++)     {         listbox1.items.add(listbox2.selecteditems[i].tostring());     }      (int = 0; < count; i++)     {         listbox2.items.remove(listbox2.selecteditems[0]);     } } 

thanks in advance!...

the windows forms control "listview" can that.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -