private void txtSearchPlane_TextChanged(object sender, EventArgs e) { try { List <Plane> planes = _planeService.GetPlanesById(txtSearchPlane.Text.Trim()); dgvPlane.Rows.Clear(); for (int i = 0; i < planes.Count; i++) { dgvPlane.Rows.Add(); dgvPlane.Rows[i].Cells["SN"].Value = i + 1; dgvPlane.Rows[i].Cells["Id"].Value = planes[i].Id.ToString(); dgvPlane.Rows[i].Cells["PlaneName"].Value = planes[i].PlaneName.ToString(); dgvPlane.Rows[i].Cells["PlaneType"].Value = planes[i].PlaneType.ToString(); dgvPlane.Rows[i].Cells["Capacity"].Value = planes[i].Capacity.ToString(); dgvPlane.Rows[i].Cells["Passengers"].Value = planes[i].PassengerNumber.ToString(); } } catch (Exception ex) { throw; } }