Hi,
In my DialogResult form which pops out when the user want to delete something ,the close button is shown disabled(cant click on it).How can i enable it?
thnx in advance

If its that dialog box s usercontrol then u can do this way,

Create instance for Usercontrol, using that instance u can get the close button ID. based on that ID assign whatever property u want to assign.

Can you specify what form you are using? DialogResult is a property of a form which can be returned if it is shown modally (ShowDialog).
Are you using a form you have designed, a MessageBox or a 3rd party control? If you have a 3rd party control then it will a bit harder for us to know what the problem is.

Hi

Thanks for the reply.I am using a MessageBox.Do you know how to enable the disabled Close button?

When you say it is "shown disabled" do you mean that is is visibly disabled (eg greyed out) or that it is there but clicking on it has no effect?
If you specify a button set for the messagebox which does not include Cancel then the close button will be clickable but nothing will happen. This is because a Yes/No box is intended to return a yes or a no, the Close button is equivalent to clicking Cancel.

Try MessageBox.Show("test", "test", MessageBoxButtons.YesNoCancel); and let me know if the same problem occurs.

Close button is disabled for these are options

1.MessageBoxButtons.AbortRetryIgnore
2.MessageBoxButtons.YesNo

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.