Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2004
    Posts
    287

    Unanswered: Changing Msgbox button labels

    Is there a way to change the vbYesNo buttons to read Update and Cancel?

    Also, a way to have a messagebox popup for xxx secs (and close without user intervention)?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Why not change your messagebox text, instead of changing the button captions:
    Code:
    Dim x
        x = MsgBox("Do you want to update?", vbYesNo)
    
        If x = vbYes Then
            MsgBox ("You clicked yes")
        ElseIf x = vbNo Then
            MsgBox ("You clicked no")
        End If
    And as far as I am aware you cannot close a messagebox programmatically. Have you thought about changing it to a form with a timer event?
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2004
    Posts
    287
    i have done the option above, just wondered if i could change the buttons from YES and NO to my own words.

    And yes I have thought about a Form on a timer, just wondered if there was an easier way via VB.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I have never come across a way of changing the MsgBox button captions, I just change my text so I can give it a standard answer. However, if you come across a way, I'd love to know how you do it!

    And once again, I don't know of any way to do this, a MsgBox is meant to do what it's meant to do, you can't change it's properties much.

    I'd create a form to mimic the MsgBox and then you can add your "Update" button and a timer event!
    George
    Home | Blog

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I don't think you can within a message box, unless you want to dabble in the dark arts of calling the windows API directly, which unless you have to use UPDATE & CANCEL Id strongly reccomend you avoid that. One of Access's strengths (and weaknesses) is that it shelters you from a lot of the windows API calls.

    you could fake a message box by pulling up a modal dialog with the buttons you require, but why?

    you could put the buttons you want onto the main form and enable/disable as required
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Mar 2004
    Posts
    287
    thanks guys. i just wondered if it could be done in VB rather than using forms and normal msgbox command... i will do it the long way round hehe

    Thanks for your help.

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Yeah - you are getting into the murky world of sub classing if you want to start playing with the innards of message boxes. I got a little beyond what is posted here but tbh it just wasn't worth the effort for what I wanted.
    http://www.dbforums.com/showthread.php?t=1605962

    Go with the bespoke form - more flexible and much easier to change. I assure you - sub classing is the long way round.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Actually, I have got loads more references for api hooks into the message box class now I look again. **IF** you get your head round the Ray Mercer link then let me know and I will post the other info. Doubt you will though...
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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