Jump to content

[Resolvido] Confirmação da alteração

Recommended Posts



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


Share this post

Link to post
Share on other sites

// 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.




Share this post

Link to post
Share on other sites
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."

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.