示例#1
0
        private void grdProperties_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            txtPropID.Text = grdProperties.Rows[grdProperties.CurrentCell.RowIndex].Cells[0].Value.ToString();
            txtRooms.Text  = grdProperties.Rows[grdProperties.CurrentCell.RowIndex].Cells[2].Value.ToString();

            int    NoOfRooms   = Convert.ToInt32(txtRooms.Text);
            Tenant total       = new Tenant();
            int    NoOfTenants = total.getSumTenants(Convert.ToInt32(txtPropID.Text));

            if (NoOfRooms <= NoOfTenants)
            {
                MessageBox.Show("Rooms all booked out!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            lblTenant.Visible = true;
            btnYes.Visible    = true;
            btnNo.Visible     = true;
        }