public void EnableButton(ref Button button, DialogResult r1) { button.Text = "&" + r1.ToString(); button.DialogResult = r1; button.Visible = true; button.Click += Button_Click; }
private void button3_Click(object sender, EventArgs e) { DialogResult dr = new DialogResult(); Form2 form2 = new Form2(); form2.SetTitle = "my pop fdgdfgfd"; form2.ActionMethod = new action(); dr = form2.ShowDialog(); MessageBox.Show(dr.ToString()); if (dr == DialogResult.Abort) MessageBox.Show("User clicked abort button----"); else if (dr == DialogResult.Cancel) MessageBox.Show("User clicked Cancel button-----"); }
//--------------------------------------------------------------------// // M e t h o d // // s e l e c t D e f W o r k F o l d e r // //--------------------------------------------------------------------// // // // Called when the 'Browse' button is clicked. // // Invoke the (Windows Forms) 'folder browser' dialogue to select the // // default working folder. // // // //--------------------------------------------------------------------// private Boolean selectDefWorkFolder(ref String targetFolder) { Boolean selected = false; FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.SelectedPath = _tmpFolder; DialogResult dlgResult = folderDialog.ShowDialog(); if (dlgResult.ToString() == "OK") { selected = true; targetFolder = folderDialog.SelectedPath; } else { selected = false; } return(selected); }
private void menuBarToolStripMenuItem_Click(object sender, EventArgs e) { if (menuBarToolStripMenuItem.Checked) { DialogResult result = MessageForm.Confirm(this, MsgE.ConfirmAccessMenubar); if (result.ToString() == "Yes") { menuStrip1.Visible = false; menuBarToolStripMenuItem.Checked = false; tableLayoutPanel1.ColumnStyles[0].Width = 0; tableLayoutPanel1.ColumnStyles[1].Width = 100; } } else { menuStrip1.Visible = true; menuBarToolStripMenuItem.Checked = true; tableLayoutPanel1.ColumnStyles[0].Width = 76; tableLayoutPanel1.ColumnStyles[1].Width = 24; } }
private void btnExcluir_Click(object sender, EventArgs e) { DialogResult resultado = MetroFramework.MetroMessageBox.Show(this, "Tem ceretza que deseja excluir?", "ATENÇÃO", MessageBoxButtons.YesNo, MessageBoxIcon.Question); try { if (resultado.ToString() == "Yes") { DALConexao conexao = new DALConexao(DadosDaConexao.StringDeConexao); BLLTipoPagamento tipoPagamento = new BLLTipoPagamento(conexao); tipoPagamento.Excluir(Convert.ToInt32(txtCodigo.Text)); MetroFramework.MetroMessageBox.Show(this, "Excluido com sucesso", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); this.limparTela(); this.alterarBotoes(1); } } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "ops Ocorreu algum erro " + ex.Message, "OK", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja realmente excluir o registro?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d.ToString() == "Yes") { _clienteApplication.InativarCliente(Convert.ToInt32(txtClienteId.Text)); MessageBox.Show("Registro Excluído com Sucesso!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); this.LimpaTela(); this.DisponibilizarBotoesTela(EnumControleTelas.InserirLocalizar); } } catch { MessageBox.Show("Impossível excluir o registro. \n O registro está sendo utilizado em outro local.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DisponibilizarBotoesTela(EnumControleTelas.AlterarExcluirCancelar); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult resultado = MetroFramework.MetroMessageBox.Show(this,"Deseja relamente excluir o produto", "Confirma", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (resultado.ToString() == "Yes") { DALConexao conexao = new DALConexao(DadosDaConexao.StringDeConexao); BLLProduto produto = new BLLProduto(conexao); produto.Excluir(Convert.ToInt32(txtCodigo.Text)); MetroFramework.MetroMessageBox.Show(this,"Deletado com suesso", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.LimpaCampos(); this.alterarBotoes(1); } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this,"Ops! ocorreu algum erro "+ ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnExcluir_Click(object sender, EventArgs e) { //antes de excluir um funcionário, verifica se é admin, pois apenas admin pode excluir if (nivelAcesso == "Admin") { DialogResult confirm = MessageBox.Show("Desaja mesmo excluir ? ", "Excluir", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); if (confirm.ToString().ToUpper() == "YES") { dll.Excluirr(dto); MessageBox.Show("Cadastro Excluido com sucesso!", "Aviso"); limpar(); } } else { MessageBox.Show("Somente administradores podem excluir clientes!", "Aviso!"); } }
/// <summary> /// Evento para el botón de borrado. Borra todos los archivos almacenados /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnCleanEvento(object sender, EventArgs e) { DialogResult dialog = MessageBox.Show("¿Está seguro de eliminar todos los archivos?", "Atención", MessageBoxButtons.YesNo); if (dialog.ToString().Equals("No")) { return; } string[] archivos = Directory.GetFiles(Directory.GetCurrentDirectory() + "\\save\\"); foreach (var value in archivos) { File.Delete(value); } MessageBox.Show("Archivos eliminados"); CargarAchivos(panelCargar); }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult resultado = MetroFramework.MetroMessageBox.Show(this, "Tem certeza que deseja realmente excluir", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (resultado.ToString() == "Yes") { DALConexao con = new DALConexao(DadosDaConexao.StringDeConexao); BLLSubCategoria categoria = new BLLSubCategoria(con); categoria.Excluir(Convert.ToInt32(txtCodigo.Text)); this.limparTela(); this.alterarBotoes(1); MetroFramework.MetroMessageBox.Show(this, "Cadastrado com sucesso", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "Ops ocorreu algum erro" + ex.Message, "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Information); this.alterarBotoes(3); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult resultado = MetroFramework.MetroMessageBox.Show(this, "Realmente deseja excluir? ", "ATENÇÃO", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (resultado.ToString() == "Yes") { ModeloUndMedida undMedida = new ModeloUndMedida(); DALConexao conexao = new DALConexao(DadosDaConexao.StringDeConexao); BLLUnidMedida medida = new BLLUnidMedida(conexao); medida.Excluir(Convert.ToInt32(txtCodigo.Text)); MetroFramework.MetroMessageBox.Show(this, "Excluido com sucesso", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); this.limparTela(); this.alterarBotoes(1); } } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "ops Ocorreu algum erro " + ex.Message, "OK", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnCancelarPizza_Click(object sender, EventArgs e) { if (this.lstPizzaAndamento.SelectedItems.Count > 0) { string linha = lstPizzaAndamento.SelectedItems[0].Text; int cdgPedido = Convert.ToInt32(linha.Substring(linha.IndexOf('(') + 5, (linha.IndexOf(')') - linha.IndexOf('(')) - 5)); DialogResult confirm = MessageBox.Show("Deseja Cancelar o pedido " + cdgPedido + "? ", "Cancelar pedido", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2); if (confirm.ToString().ToUpper() == "YES") { controle.CancelarPedido(cdgPedido); lstPizzaAndamento.Clear(); PizzasEmAndamento(); lstUltimosPedidos.Clear(); PizzasEntregues(); } } else { MessageBox.Show("Escolha uma pizza para Cancelar!"); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja excluir a categoria '" + txtDescricao.Text + "'?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { DALConexao cx = new DALConexao(DadosConexao.StringConexao); BLLCategoria bll = new BLLCategoria(cx); bll.Excluir(Convert.ToInt32(txtSequencia.Text)); this.LimpaTela(); this.alteraBotoes(1); this.alteraCampos("False"); } } catch { MessageBox.Show("Impossível excluir o registro. \n O registro está sendo utilizado em outro local."); this.alteraBotoes(3); } }
private void button2_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "请选择图像文件"; openFileDialog.Filter = "(*.jpg;*.png;*.bmp;*.jpeg;*.gif;*.tiff;*.ico)|*.jpg;*.png;*.bmp;*.jpeg;*.gif;*.tiff;*.ico"; DialogResult dialogResult = openFileDialog.ShowDialog(); if (!dialogResult.ToString().Equals("Cancel")) { try { pApplication.Open(Path.GetFullPath(openFileDialog.FileName)); } catch (Exception err) { MessageBox.Show(this, err.Message, "运行出现异常", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } }
private void btnUpdate_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to Update?", "Confirm Update", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result.ToString().Equals("Yes")) { GroupModel objStudent = new GroupModel(); objStudent.Year = ddlYear.SelectedValue.ToString(); objStudent.Semester = ddlSem.SelectedValue.ToString(); objStudent.Program = ddlProgram.SelectedValue.ToString(); objStudent.GroupNo = Convert.ToInt32(txtGroupNO.Text); objStudent.GrouID = objStudent.Year + "." + objStudent.Semester + "." + objStudent.Program + "." + objStudent.GroupNo.ToString(); objCore.updateGroup(objStudent, objCurrentStd); loadData(); //reset feilds txtGroupNO.Text = ""; } }
private void btn_browse_Click(object sender, EventArgs e) { DialogResult resDialog = openFileDialog1.ShowDialog(); if (resDialog.ToString() == "OK") { strBrowseFileName = openFileDialog1.FileName; btn_Start.Enabled = true; btn_picture_mode.Enabled = false; btn_browse.Enabled = false; } else { btn_browse.Enabled = false; btn_picture_mode.Enabled = true; btn_video_mode.Enabled = true; strPicVid = ""; groupBox3.Enabled = true; btn_load_faces.Enabled = true; } }
private void btnModificar_Click_1(object sender, EventArgs e) { DialogResult respuesta = MessageBox.Show("¿Está seguro de modificar el grado" + txtNombre.Text + "?", "Modificar Grado", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (respuesta.ToString() == "Yes") { try { Clases.ICB.ModificarGrado ( this.id, txtNombre.Text ); ResetFormulario(); } catch (Exception ex) { Clases.Mensaje.Advertencia(ex); } } }
private void DeleteSelectedToolStripMenuItem_Click(object sender, EventArgs e) { if (traceFileListView.SelectedItems.Count == 0) { return; } string text1 = "Deleted selected Trace Files?"; if (ConfigHandler.UseTranslation) { text1 = Translator.GetText("DeleteSelectedTraceFiles"); } DialogResult result = OutputHandler.Show(text1, GenericHelper.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.ToString() == "Yes") { DeleteSelectedTraceFiles(); } }
private void txtUnidadeMedida_Leave(object sender, EventArgs e) { if (this.operacao == "inserir") { int r = 0; DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLUnidadeDeMedida bll = new BLLUnidadeDeMedida(cx); r = bll.VerificaUnidadeDeMedida(txtUnidadeMedida.Text); if (r > 0) { DialogResult d = MessageBox.Show("Já existe um registro com esse valor. Deseja alterar esse registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { this.operacao = "alterar"; ModeloUnidadeDeMedida modelo = bll.CarregaModeloUnidadeDeMedida(r); txtCod.Text = modelo.UmedCod.ToString(); txtUnidadeMedida.Text = modelo.UmedNome; } } } }
public void ShowDialog_NonControlOwnerWithVisualStyles_ReturnsExpected(bool runDialogResultParam, DialogResult expectedDialogResultParam) { // Run this from another thread as we call Application.EnableVisualStyles. RemoteExecutor.Invoke((runDialogResultString, expectedDialogResultString) => { bool runDialogResult = bool.Parse(runDialogResultString); DialogResult expectedDialogResult = (DialogResult)Enum.Parse(typeof(DialogResult), expectedDialogResultString); Application.EnableVisualStyles(); using var dialog = new SubCommonDialog { RunDialogResult = runDialogResult }; var owner = new Mock <IWin32Window>(MockBehavior.Strict); owner .Setup(o => o.Handle) .Returns(IntPtr.Zero); Assert.Equal(expectedDialogResult, dialog.ShowDialog(owner.Object)); }, runDialogResultParam.ToString(), expectedDialogResultParam.ToString()).Dispose(); }
private void btExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLTipoPagamento bll = new BLLTipoPagamento(cx); bll.Excluir(Convert.ToInt32(txtCodigo.Text)); this.LimpaTela(); this.alteraBotoes(1); } } catch (Exception erro) { //MessageBox.Show(erro.Message); MessageBox.Show("Impossível excluir o registro. \n O registro esta sendo utilizado em outro local."); this.alteraBotoes(3); } }
public void GetOutputDirectoryFolder() { FolderBrowserDialog browse = new FolderBrowserDialog(); DialogResult result = browse.ShowDialog(); if (result.ToString() == "OK") { objSettings.OutputFolder = browse.SelectedPath; objSettings.CreateProcessingDirectoryStructure(); config.AppSettings.Settings.Remove("OutputFolder"); config.AppSettings.Settings.Add("OutputFolder", OutputFolder); config.Save(ConfigurationSaveMode.Full); ConfigurationManager.RefreshSection("appSettings"); RaisePropertyChanged("OutputFolder"); } }
private void btnModificar_Click(object sender, EventArgs e) { DialogResult respuesta = MessageBox.Show("Está seguro de modificar el tipo de unidad", "Modificar Tipo Unidad", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (respuesta.ToString() == "Yes") { try { Clases.Restaurante.ModificarTipoUnidad ( this.id, txtDescripcion.Text ); ResetFormulario(); } catch (Exception ex) { Clases.Mensaje.Advertencia(ex); } } }
/// <summary> /// 浏览选择要导入的文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, EventArgs e) { try { FileDialog dialog = new OpenFileDialog(); dialog.InitialDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); dialog.Filter = "Assemblies (*.xls)|*.xls;*.xlsx"; DialogResult dr = dialog.ShowDialog(); if (dr.ToString().ToUpper() == "OK") // if xml file selected, save file path to listbox. { string fileName = dialog.FileName; txtFilePath.Text = fileName; } progressBar1.Maximum = 100; progressBar1.Value = 0; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLUnidadeDeMedida bll = new BLLUnidadeDeMedida(cx); bll.Excluir(Convert.ToInt32(txtCodUmed.Text)); this.LimpaTela(); this.AlteraBotoes(1); // MessageBox.Show("message"); } } catch { MessageBox.Show("Impossível excluir esse registro. \nO registro está sendo utilizado em outro local."); this.AlteraBotoes(3); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja exluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { //obj para exckuir os dados no banco DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); BLLSubCategoria bll = new BLLSubCategoria(cx); bll.Excluir(Convert.ToInt32(txtScatCod.Text)); this.LimaTela(); this.alteraBotoes(1); } } catch { MessageBox.Show("Impossível excluir o registro. \n O registro esta sendo utilizado em outro local."); this.alteraBotoes(3); } }
/// <summary> /// this function use when user close the form while downloading /// </summary> /// <param name="e"></param> protected override void OnFormClosing(FormClosingEventArgs e) { if ((progressBar1.Value == 100) && (progressBar2.Value == 100) && (progressBar3.Value == 100) && (progressBar4.Value == 100) && (progressBar5.Value == 100) && (progressBar6.Value == 100) && (progressBar7.Value == 100) && (progressBar8.Value == 100) && (progressBar9.Value == 100) && (progressBar10.Value == 100)) { base.OnFormClosing(e); } else { DialogResult result1 = MessageBox.Show("Are you sure? ", "Alert", MessageBoxButtons.YesNo); if (result1.ToString().Contains("Yes")) { base.OnFormClosing(e); } else { e.Cancel = true; base.OnFormClosing(e); } } }
private void btndelete_Click(object sender, EventArgs e) { int k = Connection.Login("SELECT COUNT(*) AS Expr1 FROM tbl_subwiseclass WHERE (subjectno = '" + txtSubjectNo.Text + "') "); if (k > 0) { MessageBox.Show("You Can Not Delete Subject Record."); } else { DialogResult d = MessageBox.Show("Are You Sure You Want To Delete Record", "", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { Connection.AllPerform("delete from tbl_subject where subjectno='" + txtSubjectNo.Text + "' "); Connection.AllPerform("Delete from tbl_subwiseclass where subjectno ='" + txtSubjectNo.Text + "'"); MessageBox.Show("Record Deleted."); c.FillListBox("select distinct subjectno,subjectname from tbl_subject Order By subjectno", "subjectname", "subjectno", ref listBox1); DesignForm.fromClear(this); } } }
public static void DefaultPathIssue() { //Path is program root - most likely an error, alert user DialogResult dialogResult = MessageBox.Show("It seems the path to the cloud service wasn't set correctly. Choose \"Yes\" to go through the setup again. If this doesn't work, try restarting the ACC software.", "Whoops, problem!", MessageBoxButtons.YesNo); DoDebug(dialogResult.ToString()); if (dialogResult == DialogResult.Yes) { Properties.Settings.Default.HasCompletedTutorial = false; Properties.Settings.Default.ActionFilePath = ""; Properties.Settings.Default.Save(); if (gettingStarted != null) { gettingStarted.Close(); } ShowGettingStarted(); } }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to Delete?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result.ToString().Equals("Yes")) { TagModel objStudent = new TagModel(); objStudent.TagCode = txtCode.Text; objStudent.TagName = txtName.Text; objStudent.TagDescription = txtDesc.Text; objStudCore.deleteTag(objStudent); loadData(); //reset feilds txtName.Text = ""; txtDesc.Text = ""; txtCode.Text = ""; } }
private void btExcluir_Click(object sender, EventArgs e) { try { DialogResult _dialogResult = MessageBox.Show("Deseja realmente exlcuir o registro ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (_dialogResult.ToString() == "Yes") { DALConexao _dalConexao = new DALConexao(DadosDaConexao.StringDeConexao); BLLCategoria _bllCategoria = new BLLCategoria(_dalConexao); _bllCategoria.Excluir(Convert.ToInt32(txtCodigo.Text)); this.AlterarBotoes(2); this.LimpaTela(); } } catch { MessageBox.Show("Impossível excluir o registro.\nO registro esta sendo utilizado em outro local."); AlterarBotoes(3); } }
private void btnEliminar_Click(object sender, EventArgs e) { DialogResult respuesta = MessageBox.Show("¿Está seguro de deshabilitar al usuario " + this.usuario + "?", "Deshabilitar Usuario", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (respuesta.ToString() == "Yes") { try { Clases.ICB.EliminarUsuario1(this.usuario, 0); } catch (SqlException ex) { MessageBox.Show(ex.Message); } finally { this.usuario = null; ResetFormulario(); } } }
public static void Test_OpenFileDialogWithDelegate_finished(object o, DialogResult dr) { MessageBox.Show(dr.ToString()); }
private void selectFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog opd = new OpenFileDialog(); opd.Title = "Select a configration file..."; opd.Filter = "Configration Files(*.xml)|*.xml|All Files|*.*"; opd.ValidateNames = true; opd.CheckPathExists = true; opd.CheckFileExists = true; DialogResult dr = new DialogResult(); dr = opd.ShowDialog(); if (dr.ToString() == "OK") { configFilePath.Text = opd.FileName; } }
public void CallbackConfExistsDialog(DialogResult result) { Debug.Log (result.ToString ()); }
public static void Test_FolderBrowserDialogWithDelegate_finished(object o, DialogResult dr) { MessageBox.Show(dr.ToString()); }