private void viewSupplies_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow dr = viewSupplies.GetFocusedDataRow(); if (dr != null) { int selected = Convert.ToInt32(dr["ID"]); Supplier sup = new Supplier(); sup.LoadByPrimaryKey(selected); txtCompanyName.Text = sup.CompanyName; txtAddress.Text = sup.Address; txtContactPerson.Text = sup.ContactPerson; txtMobile.Text = sup.Mobile; txtTelephone.Text = sup.Telephone; txtEmail.Text = sup.Email; ckIsActive.Checked = sup.IsColumnNull("IsActive")?false: sup.IsActive; _supplierId = sup.ID; cboCompanyInfo.SelectedItem = sup.CompanyInfo; btnSupplierSave.Text = "Update"; } }