CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    4

    Unhappy How to Make Message Box as Modal

    HI,

    Iam using the MessageBoxes in my Appliation. These Message Boxes are used to display the Exception messages encountered during the User Operation on the Application.

    MessageBox.Show(Message,Title,Buttons,Icons);

    These MessageBoxes are displaying the messages in Modeless Way, i want these MessageBoxes to be Modal. Please suggest a way to achieve the same.

    Thanks in Advance,
    Harry

  2. #2
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    2,147

    Re: How to Make Message Box as Modal

    You need to call the other Show method that supplies a parent for the MessageBox dialog to have it behave in a modal way.

    The method I'm describing has the parent described as a "IWin32Window" data type in it's first parameter.

    Obviously the parent specified should be the parent window you want this to be a child of.

    Hope this helps,

    - Nigel

  3. #3
    Join Date
    Dec 2004
    Posts
    4

    Smile Re: How to Make Message Box as Modal

    Thanks for ur reply.

    I had used the other way. Something like this,

    DialogResult dlgResult = MessageBox(Message,Title,Buttons,Icons);

    This makes the Message Box Modal and can be used to check the User Choice also.

    Harry

  4. #4
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    Re: How to Make Message Box as Modal

    Code:
    DialogResult dlgResult = MessageBox.Show(Message,Title,Buttons,Icons);
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured