Search code examples
vb.net-2010messagebox

How can I control the instrument “msgbox” in VB. net


Can I show custom buttons inside MsgBox? I want different buttons from the regular buttons for msgbox which are:

  1. OK
  2. Cancel
  3. Abort
  4. Retry
  5. Ignore
  6. Yes
  7. No

How can I control the text and value of these buttons?


Solution

  • No, MsgBox is tied directly to the underlying Windows UI and cannot be easily changed or extended.
    You should create your own class or look for an already made project like this one

    A versatile MessageBox replacement

    Well, a bit of research on the subject has lead me to this old article and code

    Using Windows Hooks to Enhance MessageBox in .NET

    but it is a lot of work and perhaps you could better use your time to build your own message class.