MessageBox.Show question

  • Thread starter Thread starter Starbuck
  • Start date Start date
S

Starbuck

Hi

Using the following code is there a way of ensuring the NO button is set t
default button?

Thanks in advance



Dim reply As Integer = MessageBox.Show("Are you sure?", "Delete Record",
MessageBoxButtons.YesNo)

If reply = DialogResult.No Then Exit Sub
 
Starbuck,

The MessageBox.Show function takes in an argument for the default button.
The following code will set the default button to no:

MessageBox.Show("Are you sure?", "Delete Record", MessageBoxButtons.YesNo,
MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)

Kevin
 
Starbuck said:
Hi

Using the following code is there a way of ensuring the NO button is set t
default button?

Thanks in advance



Dim reply As Integer = MessageBox.Show("Are you sure?", "Delete Record",
MessageBoxButtons.YesNo)

If reply = DialogResult.No Then Exit Sub


The function's 5th argument is called 'defaultButton'.


Armin
 
Thanks guys


..:: Kevin ::.. said:
Starbuck,

The MessageBox.Show function takes in an argument for the default button.
The following code will set the default button to no:

MessageBox.Show("Are you sure?", "Delete Record", MessageBoxButtons.YesNo,
MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top