private void btnCrearInsumo_Click_1(object sender, EventArgs e) { if (objCrearModificar == null || objCrearModificar.IsDisposed) { objCrearModificar = new crearModificarInsumo(); objCrearModificar.Show(); this.Dispose(); } objCrearModificar.btnActualiar.Enabled = false; }
private void btnModificar_Click_1(object sender, EventArgs e) { if (tablaInventarioInsumos.CurrentRow.Index >= 0) { if (objCrearModificar == null || objCrearModificar.IsDisposed) { objCrearModificar = new crearModificarInsumo(); objCrearModificar.Show(); objCrearModificar.cajaCantidad.Enabled = false; objCrearModificar.cajaCosto.Enabled = false; objCrearModificar.cajaCantidad.BackColor = Color.Red; objCrearModificar.cajaCosto.BackColor = Color.Red; } int valorCelda = tablaInventarioInsumos.CurrentRow.Index; Console.WriteLine("el valor de la celda " + valorCelda); MySqlCommand miSentencia = new MySqlCommand("select * from insumos where idInsumo='" + tablaInventarioInsumos.Rows[valorCelda].Cells[0].Value + "'", conexion.crearConexion()); MySqlDataReader reader = miSentencia.ExecuteReader(); while (reader.Read()) { objCrearModificar.cajaCodigo.Text = reader.GetString(0); objCrearModificar.cajaNombre.Text = reader.GetString(1); objCrearModificar.cajaCosto.Text = reader.GetString(2); objCrearModificar.cajaCantidad.Text = reader.GetString(3); objCrearModificar.cajaStock.Text = reader.GetString(4); ////aqui voy objCrearModificar.comboMedida.SelectedItem = reader.GetString(5); objCrearModificar.cajaObservaciones.Text = reader.GetString(7); } objCrearModificar.btnGuardar.Enabled = false; this.Dispose(); } }