private void gridAll_CellClick(object sender, DataGridViewCellEventArgs e) { if (!txtDescription.Enabled) { try { ButtonControl(true, true, false, false, true, false); string salesid = gridAll.Rows[e.RowIndex].Cells[0].Value.ToString(); clsAdmin admin = new clsAdmin(); clsSales sales = new clsSales(); sales = admin.Search_Sales_by_RefSales(Convert.ToInt32(salesid)); cboAgent.SelectedValue = sales.RefAgent; cboClient.SelectedValue = sales.RefClient; cboHouse.SelectedValue = sales.RefHouse; txtDescription.Text = sales.Description.ToString(); DateSales.Text = sales.SalesDate.ToString(); } catch { // not in the grid content } } }