Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MessageBox and close

Status
Not open for further replies.

zdehkordi

Programmer
Oct 21, 2005
12
IR
Hi.
I use MessageBox.Show for showing OK MessageBox.
It has a close toolbox too. I think Pressing Ok is enough for users. So I am going to remove Colse toolbox, but I couldn't do it.
Do you know how can I do it?
Thanks
 
Your questions don't make sense. Let me explain how a MessageBox works in general:

Code:
DialogResult result = MessageBox.Show(this, "Text", "Caption", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

if (result == DialogResult.OK)
{
   //The ok button was pressed
}
else
{
  //The Cancel button or Close button was pressed
}

<insert stupid signature here>
 
If you want to display the message box with ONLY the ok button (which is what I think you are doing) replace his MessageBoxButtons.OKCancel with MessageBoxButtons.OK
 
Thanks.
But I mean, I want to remove Close Mark in toolbox.
 
If you use MessageBox.Buttons YesNo the x is greyed out, thats about the best I can do.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
*slight typo there, got to used to .net ;) MessageBoxButtons.YesNo , but you knew that right? :D

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
I didn't get you.
In fact YesNo doesn't help me. I want Ok MessageBox.
Thanks anyway
 
Don't think theres any way to do that to a message box, you should write your own and you will have full conrol over its behaviour.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top