private void gridAll_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!txtAddress.Enabled) { ButtonControl(true, true, false, false, true, false); string houseid = gridAll.Rows[e.RowIndex].Cells[0].Value.ToString(); clsAdmin admin = new clsAdmin(); clsHouse house = new clsHouse(); house = admin.Searched_by_RefHouse(Convert.ToInt32(houseid)); txtAddress.Text = house.Address; txtArea.Text = house.Area.ToString(); txtBath.Text = house.NumBath.ToString(); txtFloor.Text = house.Floor.ToString(); txtPrice.Text = house.Price.ToString(); txtRoom.Text = house.NumRoom.ToString(); if (house.Accessible) { cboAccess.SelectedItem = "Yes"; } else { cboAccess.SelectedItem = "No"; } cboStatus.Text = house.Status; } }
private void btnRefHouse_Click(object sender, EventArgs e) { clsHouse house = admin.Searched_by_RefHouse(Convert.ToInt32(txtRefHouse.Text)); houselist = new List <clsHouse>(); houselist.Add(house); if (houselist.Count() != 0) { gridAll.DataSource = houselist; } else { MessageBox.Show("There is no result with the RefHouse", "NO RESULT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }