ProgramadoraR Posted February 9, 2013 at 10:57 AM Report #494665 Posted February 9, 2013 at 10:57 AM Boas Como é que eu faço para me aparecer um mensagem de confirmaçao? por exemplo: "Tem a certea que pretende eliminar o registo" caso sim elimina, caso nao cancela
jpaulino Posted February 9, 2013 at 12:12 PM Report #494669 Posted February 9, 2013 at 12:12 PM Usa uma MessageBox e verifica o resultado que devolve. http://msdn.microsoft.com/en-us/library/system.windows.forms.dialogresult.aspx
ProgramadoraR Posted February 9, 2013 at 12:16 PM Author Report #494670 Posted February 9, 2013 at 12:16 PM // Checks the value of the text. if(serverName.Text.Length == 0) { // Initializes the variables to pass to the MessageBox.Show method. string message = "You did not enter a server name. Cancel this operation?"; string caption = "No Server Name Specified"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(this, message, caption, buttons); if(result == DialogResult.Yes) { // Closes the parent form. this.Close(); } assim?
pikax Posted February 9, 2013 at 12:16 PM Report #494671 Posted February 9, 2013 at 12:16 PM if (MessageBox.Show("Deseja apagar?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) return Apagar(); //Carregou no Sim return false; Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender. A beleza de um código está em decompor problemas complexos em pequenos blocos simples. "learn how to do it manually first, then use the wizzy tool to save time." "Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now