private void btnSalir_Click(object sender, EventArgs e) { resultado = MetroFramework.MetroMessageBox.Show(this, "Seguro que desea salir?", "Mensaje Salida", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (resultado.Equals(DialogResult.Yes)) { this.Close(); } }
private void button6_Click(object sender, EventArgs e) { System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); DialogResult result = openFileDialog1.ShowDialog(); if (result.Equals(DialogResult.OK)) { String fileName = openFileDialog1.FileName; List <Order> orders1 = orders.Import(fileName); if (orders1 != null) { orderBindingSource.DataSource = orders1; } } }
private void btnCreateAttendanceSheets_Click(object sender, EventArgs e) { DialogResult res = MessageBox.Show("You are going to create a pdf document with everyone in it!\nAre you sure you want to proceed?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res.Equals(DialogResult.Yes)) { // Get the list of person IDs List <int> personIDs = new List <int>(); foreach (DataGridViewRow row in dgvOverview.Rows) { personIDs.Add((int)row.Cells[0].Value); } PDFManager.CreateMultipleAttendanceSheets(personIDs); } }
private void button_Load_System_Click(object sender, EventArgs e) { string SuggestedSystemToLoad = comboBox_SystemDirectory.Text; if (!Directory.Exists(SuggestedSystemToLoad)) { DialogResult oDr = MessageBox.Show(string.Format(@"Directory {0} does not exists.{1}Would you like to create a new system?", SuggestedSystemToLoad, Environment.NewLine), "Directory does not exists", MessageBoxButtons.YesNo); SystemLocation = SuggestedSystemToLoad; if (oDr.Equals(DialogResult.No)) { this.DialogResult = DialogResult.None; return; } if (oDr.Equals(DialogResult.Yes)) { CreateNewSystem = true; } } else { SystemLocation = SuggestedSystemToLoad; } this.Close(); }
private void btnRepetir_Click(object sender, EventArgs e) { if (this.dataGridView1.CurrentRow != null && this.dataGridView1.CurrentRow.DataBoundItem != null) { Alumno alumno = dataGridView1.CurrentRow.DataBoundItem as Alumno; DialogResult result = MessageBox.Show(traducciones["com.td.seguro"], "", MessageBoxButtons.OKCancel); if (!result.Equals(DialogResult.OK)) { return; } this.servicioAlumnos.repetirAlumno(alumno); MessageBox.Show(traducciones["com.td.completado"], "", MessageBoxButtons.OK); this.listarAlumnos(null, null); } }
bool handleProxy() { bool proceedLogin = true; bool useProxy = EM_AppContext.Instance.GetUserSettingsAdministrator().Get().VCUseProxy; if (useProxy) { String proxyURL = EM_AppContext.Instance.GetUserSettingsAdministrator().Get().VCProxyURL; String proxyPort = EM_AppContext.Instance.GetUserSettingsAdministrator().Get().VCProxyPort; //This should never happen because the user cannot select "useproxy" without inserting the URL and port if (proxyURL == null || proxyURL.Equals("") || proxyPort == null || proxyPort.Equals("")) { proceedLogin = false; UserInfoHandler.ShowError("You have to insert a proxy URL and port to connect."); } _vcAdministrator.setProxyConfiguration(proxyURL, proxyPort, useProxy); DialogResult proxyCredentiasResult = DialogResult.OK; //While the user clicks OK without inserting proxy credentials while (proxyCredentiasResult.Equals(DialogResult.OK) & !_vcAdministrator.checkProxyCredentials()) { VCProxy loginDialog = new VCProxy(); proxyCredentiasResult = loginDialog.ShowDialog(); } //if the user clicks on Cancel without inserting the proxy credentials, the Log in is cancelled if (proxyCredentiasResult.Equals(DialogResult.Cancel)) { proceedLogin = false; } } return(proceedLogin); }
/// <summary> /// log out the user from the system /// </summary> private void logOutToolStripMenuItem_Click(object sender, EventArgs e) { //first check if there is no task(s) to be saved i.e check open conn with db if (cmdStartStopTime.Text.Equals("Stop Time")) { DialogResult result = MessageBox.Show("Save current task(s)?", "Save current task(s)", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result.Equals(DialogResult.Yes)) { try { //try and save user busy task and close conn with db } catch (Exception ex) { MessageBox.Show("Task could not be saved - " + ex.Message, "Save current task", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (!result.Equals(DialogResult.Cancel)) { Main fviewLogIn = new Main(); this.Hide(); fviewLogIn.Show(); } } else { Main fviewLogIn = new Main(); this.Hide(); fviewLogIn.Show(); } }
private void btnUpdateSheet_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Excel Files|*.xlsx"; DialogResult dr = ofd.ShowDialog(); if (dr.Equals(DialogResult.OK) && !string.IsNullOrWhiteSpace(ofd.FileName)) { ExcelSheet _currentSheet = new ExcelSheet(ofd.FileName); _currentSheet.UpdateSheet(); } }
public ActionResult EliminarCa(int id) { Session["UserIDG"] = Session["UserIDG"]; Session["UserID"] = Session["UserID"]; Session["User"] = Session["User"]; string texto = "Estas seguro de Eliminar la categoria?"; string titulo = "Eliminar Categoria"; MessageBoxButtons button = MessageBoxButtons.YesNoCancel; MessageBoxIcon icon = MessageBoxIcon.Question; DialogResult result = MessageBox.Show(texto, titulo, button, icon); List <Topics> topics = new List <Topics>(); Comments comments = new Comments(); Topics top = new Topics(); topics = top.getAllTopicsByCatID(id); if (result.Equals(System.Windows.Forms.DialogResult.Yes)) { for (int i = 0; i < topics.Count; i++) { if (!comments.DeleteCommentsByIDTopic(topics[i].id_topic)) { MessageBox.Show("Comentario de " + topics[i].id_topic + "no eliminado"); } } if (!top.DeleteTopicsByIDCat(id)) { MessageBox.Show("Topic de " + id + "no eliminado"); } String sql = "Delete from Category where id_category = '" + id.ToString() + "'"; int retorno = 0; using (SqlConnection connection = BD.getConnection()) { SqlCommand Comando = new SqlCommand(string.Format(sql), connection); retorno = Comando.ExecuteNonQuery(); connection.Close(); } if (retorno > 0) { MessageBox.Show("Categoria Borrada Con Exito!!", "Eliminada", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo borrar la Categoria", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } return(RedirectToAction("Categorias", "Home")); }
private void btnDelete2_Click(object sender, EventArgs e) { if (this.chkeliminar.Checked) { // eliminar multiple desde el datagridview; DialogResult result = MessageBox.Show("Estas seguro que deseas eliminar los registros seleccionados?", Configuration.system_name, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result.Equals(DialogResult.OK)) { int codigo; int rpta = 0; int cont = 0; foreach (DataGridViewRow row in dgvData.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { codigo = Convert.ToInt32(row.Cells[1].Value); rpta = deleteMultipleFromDatagridView(codigo); if (rpta == 1) { cont++; } else { Messages.errorMessage(Configuration.error_message); } } } if (cont == 0) { Messages.successMessage("No se ha eliminado ningún registro"); } else if (cont == 1) { Messages.successMessage("Se ha eliminado un registro exitosamente"); } else { Messages.successMessage("Se han eliminado " + cont + " registros exitosamente"); } this.fillDatagrid(); } } else { Messages.exclamationMessage("Debe seleccionar el/los registros a eliminar"); } }
public void ExcelExport(DataGridView dataGridView1, SaveFileDialog saveFileDialog1) { try { Excel._Application xlApp; Excel._Workbook xlWorkBook; Excel._Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.Application(); xlWorkBook = xlApp.Workbooks.Add(misValue); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); int i = 0; int j = 0; for (j = 1; j <= dataGridView1.ColumnCount - 1; j++) { xlWorkSheet.Cells[1, j] = dataGridView1.Columns[j].HeaderText; } for (i = 0; i <= dataGridView1.RowCount - 1; i++) { for (j = 1; j <= dataGridView1.ColumnCount - 1; j++) { DataGridViewCell cell = dataGridView1[j, i]; xlWorkSheet.Cells[i + 2, j] = cell.Value; } } DialogResult result = saveFileDialog1.ShowDialog(); if (result.Equals(DialogResult.OK)) { xlWorkBook.SaveAs(saveFileDialog1.FileName, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue); xlWorkBook.Close(true, misValue, misValue); xlApp.Quit(); releaseObject(xlWorkSheet); releaseObject(xlWorkBook); releaseObject(xlApp); MessageBox.Show("Excel file created , you can find the file " + saveFileDialog1.FileName);//c:\\csharp.net-informations.xls"); } } catch { } }
/// <summary> /// PRE: la clase debe estar inicializada /// POST: Devuelve true si todos los campos cumplen el formato y falso en caso contrario y muestra un mensaje de error del primer formato que se ha encontrado erroneo /// </summary> /// <returns></returns> private bool formatosCorrectos() { bool correcto = true; String mensaje = ""; Object c = this.cCliente.SelectedItem; if (correcto && c == null) //no hay ningun cliente seleccionado { mensaje = "Selecciona un cliente"; correcto = false; } String fecha = this.tbFecha.Text; DateTime resultado; if (correcto && !DateTime.TryParse(fecha, out resultado)) { mensaje = "El formato de la fecha es incorrecto"; correcto = false; } if (correcto && this.tbEstado.Text.TrimStart().Length == 0) { mensaje = "Introduce el estado"; correcto = false; } if (correcto && this.clbVehiculos.CheckedItems.Count == 0) { mensaje = "Debes añadir algun vehiculo al presupuesto"; correcto = false; } if (!correcto) { DialogResult dr = MessageBox.Show(mensaje, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (dr.Equals(DialogResult.OK)) { this.DialogResult = DialogResult.None; } } return(correcto); }
private void btnGuardar_Click(object sender, EventArgs e) { //Instancia de administracion //Si el usuario no es administrador var permiso = MainContainer.sesion.Id_tipo; DialogResult admin = DialogResult.Yes; if (permiso != 1) { var adminmodule = new Transacciones.Administracion("Guardar nuevo registro"); adminmodule.ShowDialog(); admin = adminmodule.resultado; } if (admin.Equals(DialogResult.Yes)) { bool ban = Validaciones(); if (ban) { int result = -1; try { result = ConductorController.modificar(id_edicion, txtCedula.Text, txtNombres.Text, txtApellidos.Text, txtDirecion.Text, txtTelefono.Text, txtCorreo.Text, rbtnActivo.Checked, txtLicencia.Text); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error durante la insercion de datos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } if (result > 0) { limpiarControles(); MessageBox.Show("Socio Agregado Correctamente!", "Registros Actualizados", MessageBoxButtons.OK, MessageBoxIcon.Information); reload(); habilitarEdicion(false); } else if (result == 0) { MessageBox.Show("No hubo cambios en el registro", "Registro sin Cambios", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (result < 0) { MessageBox.Show("No se ha podido Ingresar", "Error durante la insercion", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void moveNext() { if (index < files.Count - 1) { view(++index); } else { DialogResult res = MessageBox.Show("已浏览完毕,是否从头开始?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (res.Equals(DialogResult.OK)) { index = 0; view(index); } } }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult confirmation = MessageBox.Show("Are you sure you want to delete this item?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (confirmation.Equals(DialogResult.No)) { return; } ObjectId id = ObjectId.Parse(dgv.SelectedRows[0].Cells[0].Value.ToString()); FilterDefinition <BsonDocument> filter = Builders <BsonDocument> .Filter.Eq("_id", id); collection.DeleteOne(filter); loadItems(); frmAddBill.loadItems(); }
private void pictureBox1_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Password's files | *.password"; ofd.DefaultExt = ".password"; ofd.Multiselect = false; ofd.InitialDirectory = IniFile.ReadINI(Form1.Profile, "workpath"); DialogResult dr = ofd.ShowDialog(); if (dr.Equals(DialogResult.OK)) { System.Diagnostics.Process process = System.Diagnostics.Process.Start(Application.ExecutablePath, "\"" + ofd.FileName + "\""); this.Close(); } }
private void btnSil_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Sil", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { int id = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <int>(gridViewOtherExpenses.GetFocusedRowCellValue("Id")); OtherExpenses selectedVehicle = OtherExpensesProvider.Instance.GetItem(id); selectedVehicle.IsMarkedForDeletion = true; OtherExpensesProvider.Instance.Save(selectedVehicle); this.LoadGrid(); } else { } }
private void btnSeleccionar_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog folderBrowserDlg = new FolderBrowserDialog(); // BOTON DE NUEVO FOLDER ACTIVADO folderBrowserDlg.ShowNewFolderButton = true; // MOSTRAR CUADRO DE DIALOGO DialogResult dlgResult = folderBrowserDlg.ShowDialog(); if (dlgResult.Equals(DialogResult.OK)) { // MOSTRAR CARPETA ELEGIDA EN CUADRO DE TEXTO; txtRutaTodos.Text = folderBrowserDlg.SelectedPath; //Environment.SpecialFolder rootFolder = folderBrowserDlg.RootFolder; } }
public void show_browse_bt() { var t = new Thread((ThreadStart)(() => { DialogResult dialog_res = folder_dialog.ShowDialog(); if (dialog_res.Equals(DialogResult.OK)) { folder_path = folder_dialog.SelectedPath; } })); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); folder_path_tb.Text = folder_path; }
private void button1_Click(object sender, EventArgs e) { DialogResult resultado = MessageBox.Show("quieres dejarlo como estaba ?", "conversion", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (resultado.Equals(DialogResult.OK)) //si el usuario dice que si { formulario1 = new Form1(); formulario1.Convertir(textBox2.Text); Hide(); formulario1.Show(); } else { Close(); } }
private void selectFolderButton_Click(object sender, EventArgs e) { using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { DialogResult result = fbd.ShowDialog(); if (result.Equals(DialogResult.OK) && !string.IsNullOrEmpty(fbd.SelectedPath)) { selectFolderButton.Visible = false; selectedPathLabel.Text = fbd.SelectedPath; selectedPathLabel.Visible = true; processingLabel(string.Empty, false); ErrorLabel(string.Empty, false); } } }
private void btn_exit_Click(object sender, EventArgs e) { if (app.IsBusy()) { var text = app.Language.Text.UIComponent; DialogResult dResult = MessageBox.Show(text.ConfirmCancel, text.AppName, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dResult.Equals(DialogResult.OK)) { app.Cancel(); } } else { app.CloseLauncher(); } }
private string GetFileName() { OpenFileDialog dialog = new OpenFileDialog() { InitialDirectory = @"C:", Title = $"Load Custom Firmware", }; DialogResult result = dialog.ShowDialog(); if (result.Equals(DialogResult.OK)) { return(dialog.FileName); } return(string.Empty); }
/// <summary> /// Open File Button Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_open_file_Click(object sender, EventArgs e) { //Show open file dialog openFileDialog.FileName = ""; DialogResult result = openFileDialog.ShowDialog(); if (result.Equals(DialogResult.OK)) { Utility.Log("File name:", openFileDialog.FileName); //File picked to get here //Setup Excel Workbook using Path Setup_Workbook(openFileDialog.FileName); button_process_data.Enabled = true; } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new test()); //Application.Run(new DataBaseCopyForm()); //return; LoginForm form1 = new LoginForm(); DialogResult result = form1.ShowDialog(); if (result.Equals(DialogResult.Yes)) { Application.Run(new MainForm()); } }
private void HighTempAlert(string sDevice) { if (!m_bTempWarningModalIsOpen && !registryManager.GetIgnoreTempWarnings()) { m_bTempWarningModalIsOpen = true; DialogResult UserInput = MessageBox.Show(sDevice + " Temps are above " + m_iTemperatureAlert.ToString() + " degrees!\r\nConsider turning fan speeds higher.\r\n\r\nSave ignore warnings in config?", "WARNING!", MessageBoxButtons.YesNo); if (UserInput.Equals(DialogResult.Yes)) { registryManager.SetIgnoreTempWarnings(true); } else { registryManager.SetIgnoreTempWarnings(false); } } }
private void radioButton_serverOffline_Click(object sender, EventArgs e) { if (exitControl > 0) { pb_serverStatus.Image = global::Vendas.View.Properties.Resources.Network_Offline_Alt; DialogResult result = MessageBox.Show("Deseja encerrar a aplicação do servidor?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.Equals(DialogResult.No)) { return; } Application.Exit(); } exitControl++; }
private void rbtnRestore_Click(object sender, EventArgs e) { DialogResult = MessageBox.Show("Are you sure you want to restore database from last backup?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Equals(DialogResult.Yes)) { System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/C mongorestore --db clinic --dir c:/backup/clinic"; process.StartInfo = startInfo; process.Start(); MessageBox.Show("Operation successful!", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Information); } }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to delete this record?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.Equals(DialogResult.Yes)) { var update = Builders <BsonDocument> .Update .Pull("history", new BsonDocument { { "_id", ObjectId.Parse(currentHistory) } }); collection.UpdateOne(filter, update); if (historyEmpty()) { setEmpty(); } } }
private void salirToolStripMenuItem_Click(object sender, EventArgs e) { //close app DialogResult result = MessageBox.Show(traducciones["com.td.seguro"], "", MessageBoxButtons.OKCancel); if (!result.Equals(DialogResult.OK)) { return; } Usuario usu = new Usuario(); usu.id = TrabajoDeCampo.Properties.Settings.Default.SessionUser; this.servicioSeguridad.grabarBitacora(usu, "El usuario salio de la aplicación", CriticidadEnum.BAJA); Application.Exit(); }
private void BrowseForArtBtn_Click(object sender, EventArgs e) { if (activePanel != null) { BrowseForArt.Filter = "Images(*.BMP;*.JPG;*.GIF,*.PNG,*.TIFF)|*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF"; DialogResult result = BrowseForArt.ShowDialog(); if (result.Equals(DialogResult.OK)) { activePanel.game.coverArtPath = BrowseForArt.FileName; gameLibraryController.UpdateGame(activePanel.game); activePanel.SetImage(); activePanel.gameCoverArt.Refresh(); coverArtPathLabel.Text = activePanel.game.coverArtPath; } } }
///<summary> /// /// Metodo para selecionar arquivos para anexar a mensagem /// ///</summary> private void selecionarBotao_Click(object sender, EventArgs e) { resultado = anexar.ShowDialog(); HashSet<string> conjunto = new HashSet<string>(); if (resultado.Equals(DialogResult.OK)) { foreach (string file in anexar.FileNames) { conjunto.Add(file); } uniaoHash(conjunto); dataGridInserir(); } }
private void btnEliminar_Click(object sender, EventArgs e) { resultado = MessageBox.Show("¿Desea dar de baja a este registro?", "Mensaje de confimación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultado.Equals(DialogResult.Yes)) { string codigo = (string)dataGridView.CurrentRow.Cells["cod_categoria"].Value; Console.Write("el codigo es " + codigo); int resultado2 = MetodosBD.ActualizarEstadoCategoria(codigo, false); if (resultado2 > 0) { MessageBox.Show("Registro dado de baja exitosamente¡¡", "Mensaje de Confirmación"); chEstado.Text = "Inactivo"; chEstado.ForeColor = Color.Red; btnEliminar.Enabled = false; dataGridView.DataSource = MetodosBD.cargarCategoria(); } } else { } }
private void button_browse_Click(object sender, EventArgs e) { saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "Log files (*.log)|*.log"; dialogResult=saveFileDialog1.ShowDialog(); if (dialogResult.Equals(DialogResult.OK)) { filePath=saveFileDialog1.FileName; string[] s = filePath.Split('\\'); textbox_filename.Text = s[s.Length-1]; } }
///<summary> /// /// Método para selecionar os arquivos e chamar metodo para inserir /// no dataGridView /// ///</summary> private void selecionaArquivos() { resultado = anexar.ShowDialog(); if (resultado.Equals(DialogResult.OK) && tabArmazena.SelectedIndex == 0) { insereCriptoDataGridView(); } else if (resultado.Equals(DialogResult.OK) && tabArmazena.SelectedIndex == 1) { insereDescriptoDataGridView(); } }
private void btnAnular_Click(object sender, EventArgs e) { string numFact = Microsoft.VisualBasic.Interaction.InputBox("Ingrese el Número de Factura", "Mensaje de Busqueda"); result = MessageBox.Show("¿Desea Anular esta Factura?", "Mensaje de confimación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.Equals(DialogResult.Yes)) { bool anulado = MetodosBD.facturaAnulada(numFact); if(anulado) { MessageBox.Show("Error la Factura esta anulada"); } else { int resultado = MetodosBD.ActualizarAnulacionFactura(numFact, true); if (resultado >= 1) { string producto; List<DetalleFactura> detalle = MetodosBD.cargarDetalleFactura(numFact); foreach (DetalleFactura d in detalle) { producto = MetodosBD.buscarProducto(d.CodProducto); int stockViejo = MetodosBD.buscarStock2(producto); int newStock = stockViejo + d.Cantidad; MetodosBD.ActualizarStock2(producto, newStock); } MessageBox.Show("Factura anulada"); } else { MessageBox.Show("Factura no encontrada"); } } } }
private void dataGridViewFactura_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { result = MessageBox.Show("¿Desea eliminar este producto de la Factura?", "Mensaje de confimación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.Equals(DialogResult.Yes)) { string producto = (string)dataGridViewFactura.CurrentRow.Cells["columnProducto"].Value; int cantidad = (int)dataGridViewFactura.CurrentRow.Cells["columnCantidad"].Value; double total3 = (double)dataGridViewFactura.CurrentRow.Cells["columnTotal"].Value; Console.Write("total columna " + total3); Console.Write("subtotal antigua " + subTotal); double sub = Convert.ToDouble(txtSubTotal.Text); subTotal = sub - total3; iva = subTotal * 0.12; totalFinal = iva + subTotal; txtSubTotal.Text = Convert.ToString(subTotal); txtIva.Text = Convert.ToString(iva); txtTotal.Text = Convert.ToString(totalFinal); int stockViejo = MetodosBD.buscarStock2(producto); int newStock = stockViejo + cantidad; MetodosBD.ActualizarStock2(producto, newStock); dataGridViewProducto.DataSource = MetodosBD.cargarProductos2(); dataGridViewFactura.Rows.Remove(dataGridViewFactura.CurrentRow); dataGridViewProducto.ClearSelection(); //dataGridViewFactura.ClearSelection(); } }