Actually the question itself, there is a string which must be assigned a value
object _id = kontr_dg.Rows[i].Cells["id"].Value; at the output _id = null although the right side is equal to the value 2. Tried on another
string _id = kontr_dg.Rows[i].Cells["id"].Value.toString(); same on output _id = null. Tell me what to do?
piece of code where this line is:
MySqlDataAdapter sda = new MySqlDataAdapter("select id,name,inn,adress,type from kontr",con); DataSet ds = new DataSet(); sda.Fill(ds); kontr_dg.DataSource = ds.Tables[0]; for (int i = 0; i < kontr_dg.Rows.Count; i++) { //Название с ОПФ object _id = kontr_dg.Rows[i].Cells["id"].Value; string name_opf = core.kontr_name_opf(_id.ToString()); kontr_dg.Rows[i].Cells["name"].Value = name_opf.ToString(); }
kontr_dg.AllowUserToAddRows = false;ori < kontr_dg.Rows.Count - 1in a loopi < kontr_dg.Rows.Count - 1to ignore the dummy row. - Ev_Hyper