hello every boduy i need a help an i think it's the better place in the world when i can found this

so my problem ;

know i have a messagebox with retry and cancel

but now i need a new messagebox with accept retry and cancel when i can found this or how i can do that thank you for u r help ;)

Recommended Answers

All 8 Replies

hey jimbojam and all around the world

but i see that to , but in my application i need to give the choice to the user and he have 3 choice , accept , retry , and cancel , but whith this methode i can't do this so per heps another solution

You'll have to create your own MessageBox class (call it something other than MessageBox or you'll probably have issues) and implement your own buttons.

in this time a crete a form with some button but , how i can init action for one button ?

Dear this is my Basic Tutorial to customize messagebox.show()

 DialogResult dr=MessageBox.Show("hello hassan", "name", MessageBoxButtons.YesNo,MessageBoxIcon.Error);
            if (dr==DialogResult.Yes)
            {
                MessageBox.Show("yes");

            }
            else
                MessageBox.Show("no");

A simple way to do what you want is to use the Yes/No/Cancel option of the MessageBox and re-phrase your question.

private void button1_Click(object sender, EventArgs e)
        {
            string message = string.Format("Press Yes to Accept,{0}No to Retry.", Environment.NewLine);
            DialogResult Result = MessageBox.Show(message, "Is This OK?",
                              MessageBoxButtons.YesNoCancel, 
                              MessageBoxIcon.Question, 
                              MessageBoxDefaultButton.Button2);
            MessageBox.Show(Result.ToString(), "Result=");
        }

That is a very good example of how to create a dialog box in c++ using Microsoft Foundation Classes.

This is the C# forum for Microsoft .Net!

Here a few of the more appropriate custom message box examples found using Google.

http://www.codeguru.com/csharp/.net/net_general/eventsanddelegates/article.php/c13193__2/Creating-a-Custom-Message-Box.htm
http://www.codeproject.com/KB/cs/A_Custom_Message_Box.aspx
http://www.techlicity.com/blog/dotnet-creating-a-custom-messagebox.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.