i am having an error to a code that i was practicing online, i actually copy codes from someone to practice and see the output
here is the code public static void LoadData(string qry, DataGridView gv, ListBox lb) { //serial no in gridview gv. CellFormatting += new DataGridViewCellFormattingEventHandler(gv_CellFormatting); try { SqlCommand cmd = new SqlCommand(qry, con); cmd. CommandType = CommandType. Text SqlDataAdapter sda = new SqlDataAdapter(cmd) ; DataTable dt = new DataTable() ; da. Fill(dt); for(int i = 0; i < lb. Items. Count; i++) { string colNam1 = ((DataGridView) lb. Items[i].ToString() } gv. DataSource = dt; } catch (Exception ex) { MessageBox. Show(ex.ToString()) ; con. Close() ; } } i just copy the code to someone but while watching it they didn't encounter error on that part but I do so idk what to do should i link something? thank u for help :)