コード例 #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //get a repair based on column 1 of repairs
            Repair rep = new Repair();

            rep.getRepair(Convert.ToInt32(grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[0].Value));

            //fill fields with repair details
            txtRepairID.Text = (Convert.ToInt32(grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[0].Value)).ToString();
            cmbStatus.Text   = (grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[3].Value).ToString();
        }
コード例 #2
0
        private void grdAllRepair_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //find repair details
            Repair rep = new Repair();

            rep.getRepair(Convert.ToInt32(grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[0].Value));

            if (rep.getCustomerID().Equals(0))
            {
                MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            //display Repair details
            txtRepairID.Text = (Convert.ToInt32(grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[0].Value)).ToString();
            cmbStatus.Text   = (grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[3].Value).ToString();
        }