CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: msgbox question

  1. #1
    Join Date
    Mar 2005
    Location
    SouthEastern, PA
    Posts
    67

    msgbox question

    I would like to use a MSGBOX in a a piece of code I am writting in a VB 6 application.

    I know how to use the standard msgbox but is there any way to change the wording on the buttons?

    For example: I am giving the user an option to print a report in Landscape or Portrait. The report contents are a little different. What I would like to do is issue a msgbox:
    Code:
    Dim Ans as Single
    Ans = msgbox("Portrait or Landscape?",vbyesno,"Print Orientation")
    If Ans = vbyes then.......
    Instead of the BUTTONS saying "Yes" "No" , is there any way to have them read "Portrait" "Landscape"?

    Thanks,
    Sam
    Sam

  2. #2
    Join Date
    Oct 2006
    Posts
    327

    Re: msgbox question

    Hello,

    No, you can't use other buttons but the ones predefined by VB.
    You may of course make your own msgbox (using a form or a frame for this purpose) and design it your whole personal way.

  3. #3
    Join Date
    Mar 2005
    Location
    SouthEastern, PA
    Posts
    67

    Re: msgbox question

    Quote Originally Posted by moa
    Hello,

    No, you can't use other buttons but the ones predefined by VB.
    You may of course make your own msgbox (using a form or a frame for this purpose) and design it your whole personal way.

    Moa:

    Thanks for the reply. I thought there might be an "API". It's not what I was hoping for but you can't have everything in life.

    Sam
    Sam

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: msgbox question

    Well Sam, there is a MessageBox API, but in this case it won't help you much.

    This is much more complicated

    You'd need to Hook the MessageBox and with several API's change the Button values of that MessageBox. An important thing to note here is that the MessageBox Buttons return values will still remain the same.
    So, meaning, we can change the Text of the Yes and No Buttons, but their return values will still be 6 for yes, and 7 for No - but I think you can live with that

    Anyways, enough rambling..
    Have a look at this attachment (NOT done by me ), it will help you a lot with your issue
    Last edited by HanneSThEGreaT; December 19th, 2008 at 03:15 AM.

  5. #5
    Join Date
    Aug 2006
    Posts
    145

    Re: msgbox question

    and here's another hacked version, using API Timers (which does return 1, 2 or 3)

    edit: but I would whole heartedly recommend making your own custom form.

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: msgbox question

    Quote Originally Posted by bushmobile
    edit: but I would whole heartedly recommend making your own custom form.
    Ditto! It will end up being the less complicated and less time consuming effort.

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