How do I underline a character in a label's caption WITHOUT getting the Alt-Letter functionality?

Posted on 2005-05-09
Last Modified: 2008-02-26
I have a label and need to underline the first letter of its caption, but I do NOT want the Alt-Letter keystroke to get automatically handled... This is because I have a custom handler for that Alt-Letter keystroke, so I can't have some darn label intercepting it...

Alternatively, if I knew what (if any handle-able) event(s) get fired when one does hit that Alt-Letter keystroke, I could just call my custom handler from that event-handler...

Question by:Melvinivitch
    LVL 18

    Accepted Solution

    A workaround is to use two label controls. The first label control will have caption as the letter that needs to be underlined and set the font to "Underline". The second lable will contain the rest of the part of the word. Place the two labels together in such a way, that they look like one label.
    LVL 18

    Expert Comment

    YOu can also use the following label control in which you can write HTML. This will let you underline a portion of your text. The control is free of cost.:
    LVL 9

    Expert Comment

    by:Naveen Swamy
    use line control, to underline

    M.Naveen Swamy
    LVL 18

    Expert Comment

    I did not understand, why I got B grade for the answer? Did you get a better workaround?

    Author Comment

    Sorry - I was hoping for a way to catch the event that gets fired, or to disable that functionality for the label...

    And when it asks for a grade, it lists B as "Good", which your answer was... I certainly didn't mean to imply that it was bad. I'm new here, so perhaps I don't understand how grades are typically assigned. If workable answers always get an A, I'll happily re-grade you to an A, if that's possible. ... I was just going by the descriptions listed next to the grades when I'm presented with the grading option...
    LVL 18

    Expert Comment

    Not a problem. You cant capture the event with label because hot keys are not fired with label controls. Infact instead of going through all these workarounds, I should have told you that earlier and it never struck me. Probably I deserve B than A :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now