示例#1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            editVehiclesForm edit = new editVehiclesForm();

            edit.comboBoxCardID.Text        = dataGridViewVehicle.CurrentRow.Cells[0].Value.ToString();
            edit.dateTimePickerInTime.Value = Convert.ToDateTime(dataGridViewVehicle.CurrentRow.Cells[6].Value.ToString());
            edit.comboBoxShape.Text         = dataGridViewVehicle.CurrentRow.Cells[8].Value.ToString();
            string loaixe = dataGridViewVehicle.CurrentRow.Cells[1].Value.ToString();

            if (loaixe == "Xe May")
            {
                edit.radioButtonMoto.Checked = true;
            }
            else if (loaixe == "Xe Dap")
            {
                edit.radioButtonBike.Checked = true;
            }
            else
            {
                edit.radioButtonCar.Checked = true;
            }
            if (dataGridViewVehicle.CurrentRow.Cells[2].Value.ToString() != "")
            {
                byte[]       bytes = (byte[])(dataGridViewVehicle.CurrentRow.Cells[2].Value);
                MemoryStream ms    = new MemoryStream(bytes);
                edit.pictureBoxLicensePlate.Image = Image.FromStream(ms);
            }
            if (dataGridViewVehicle.CurrentRow.Cells[3].Value.ToString() != "")
            {
                byte[]       bytes = (byte[])(dataGridViewVehicle.CurrentRow.Cells[3].Value);
                MemoryStream ms    = new MemoryStream(bytes);
                edit.pictureBoxUser.Image = Image.FromStream(ms);
            }
            if (dataGridViewVehicle.CurrentRow.Cells[4].Value.ToString() != "")
            {
                byte[]       bytes = (byte[])(dataGridViewVehicle.CurrentRow.Cells[4].Value);
                MemoryStream ms    = new MemoryStream(bytes);
                edit.pictureBoxModel.Image = Image.FromStream(ms);
            }
            if (dataGridViewVehicle.CurrentRow.Cells[5].Value.ToString() != "")
            {
                byte[]       bytes = (byte[])(dataGridViewVehicle.CurrentRow.Cells[5].Value);
                MemoryStream ms    = new MemoryStream(bytes);
                edit.pictureBoxVehiclePicture.Image = Image.FromStream(ms);
            }

            edit.Show(this);
        }
示例#2
0
        private void editVehicleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            editVehiclesForm editForm = new editVehiclesForm();

            editForm.Show(this);
        }
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            editVehiclesForm editForm = new editVehiclesForm();

            editForm.ShowDialog(this);
        }