We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
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

MercilessKiller
Posts: 7,143 Forumite


in Techie Stuff
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();
}
}
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]
- Bob Dole, Republican presidential candidate[/FONT]
0
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]0 -
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."0 -
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]0 -
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]0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

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