private void btnEditVehicle_Click(object sender, EventArgs e) { if (grdVehicles.SelectedRows.Count > 0) { AddOrUpdateVehicleForm form = new AddOrUpdateVehicleForm(this); form.isEdit = true; form.titleVehicle.Text = "Modificar Vehiculo"; form.textEnrollment.Text = grdVehicles.CurrentRow.Cells["Matricula"].Value.ToString(); form.comboBoxBrands.Text = grdVehicles.CurrentRow.Cells["Marca"].Value.ToString(); form.comboBoxLine.Text = grdVehicles.CurrentRow.Cells["Linea"].Value.ToString(); form.textBoxModel.Text = grdVehicles.CurrentRow.Cells["Modelo"].Value.ToString(); form.textBoxColor.Text = grdVehicles.CurrentRow.Cells["Color"].Value.ToString(); form.comboBoxDoors.Text = grdVehicles.CurrentRow.Cells["Puertas"].Value.ToString(); establecerValorRadioButtonGPS(); form.comboBoxType.Text = grdVehicles.CurrentRow.Cells["Tipo"].Value.ToString(); form.comboBoxClass.Text = grdVehicles.CurrentRow.Cells["Clase"].Value.ToString(); form.textBoxPrice.Text = grdVehicles.CurrentRow.Cells["Precio"].Value.ToString(); form.idVehicle = grdVehicles.CurrentRow.Cells["Id"].Value.ToString(); form.ShowDialog(); } else { MessageBox.Show("Seleccione una fila!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/*private void txtBuscar_TextChanged(object sender, EventArgs e) * { * if (txtBuscarVehiculo.Text != "") * { * grdVehicles.DataSource = WorkVehicle.searchVehicle(txtBuscarVehiculo.Text); * } * else * { * if (txtBuscarVehiculo.Text == "") * loadVehiclesSP(); * } * }*/ private void establecerValorRadioButtonGPS() { AddOrUpdateVehicleForm form = new AddOrUpdateVehicleForm(); if (grdVehicles.CurrentRow.Cells["GPS"].Value.Equals(true)) { form.radioButton1.Checked = true; form.radioButton2.Checked = false; } else { form.radioButton1.Checked = false; form.radioButton2.Checked = true; } }
private void btnRegisterVehicle_Click(object sender, EventArgs e) { AddOrUpdateVehicleForm form = new AddOrUpdateVehicleForm(this); form.ShowDialog(); }