We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

C# MessageBox class in Visual Studio 2005 help

Options
Hihi.

Just getting on with some programming and come across a strange (but prob simple to solve) problem.

On the microsoft database, it gives an example of how to use a messagebox show method with buttons such as yes/no etc...

It gives the example in multiple languages inc C#. On directly copying the code for testing purposes of course, it says "No overload method for 'Show'". I'm going a bit crazy here. The code is posted below. Any help would be appreciated.

(NB: I'm using the Visual Studio 2005 environment and its a PocketPC application I'm developing using C#. Thanks)




private void menuExit_Click(object sender, EventArgs e)
!!
string message = "Are you sure you want to exit?";
string caption = "Exit";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;

// Displays the MessageBox.

result = MessageBox.Show(message, caption, buttons);

if (result == System.Windows.Forms.DialogResult.Yes)
!!

// Closes the parent form.

this.Close();

}
}
[FONT=Arial, Helvetica, sans-serif]"The internet is a great way to get on the net."
- Bob Dole, Republican presidential candidate
[/FONT]

Comments

  • grrr the open squiggle bracket symbol turns into !! for some reason. Please bear that in mind but it is correct.
    [FONT=Arial, Helvetica, sans-serif]"The internet is a great way to get on the net."
    - Bob Dole, Republican presidential candidate
    [/FONT]
  • wolfman
    wolfman Posts: 3,225 Forumite
    Hmmm I don't work with Windows forms much, but it looks ok to me.

    MessageBox.Show() even has a method for passing just a message, caption and MessageBoxButtons object (which you're using). Don't have time to try running it myself now, may try later if I have time.
    "Boonowa tweepi, ha, ha."
  • I tried passing it directly but that didnt work thus now using the seperate objects.... Still not working though!

    Just get this error about not being able to overload the show method! grrr going insane lol
    [FONT=Arial, Helvetica, sans-serif]"The internet is a great way to get on the net."
    - Bob Dole, Republican presidential candidate
    [/FONT]
  • Wahooo figured it out!

    PocketPC uses a compact framework which doesnt support string,string,button... it supports string,string,button,icon,defaultbutton though so used that and it works :) *thanks self* :P
    [FONT=Arial, Helvetica, sans-serif]"The internet is a great way to get on the net."
    - Bob Dole, Republican presidential candidate
    [/FONT]
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.9K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.9K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.9K Life & Family
  • 257.2K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.