message box custom buttons...

dtvonly

Member
Joined
Jan 3, 2013
Messages
22
Programming Experience
5-10
Hi. VB.net lets me choose one of the "system's" message box button style; e.g. MsgBoxStyle.Ok, MsgBoxStyle.OkCancel.

What if I wanted to create two buttons (PASS and FAIL buttons) on a message box, how is this done? Or do I have to create then display a new form?
 
Or do I have to create then display a new form?
Yes, and it is easy. "Add New Item" and choose Dialog as template instead of blank Form. Use ShowDialog method to display it.
 
Better use the default DialogResult values that ShowDialog function returns. Assign a DialogResult value to each of your buttons and use that.
The template code also show how you can assign a DialogResult value to the dialog in code, if you need to do that, but it is not necessary if you set it for each button.
 
Back
Top