Results 1 to 8 of 8

Thread: [rslvd:Thnx 2 si_the_geek]How do I make a buttons Text = &

  1. #1

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    [rslvd:Thnx 2 si_the_geek]How do I make a buttons Text = &

    I'm adding some buttons dynamically, actually 256 {I'm going to scale that down some}, 1 per each of 255 ASCII codes. And for each, its text = chr(i), i = 0 to 255.

    Now, the button who's i = 38 should display as &, but it's blank.
    More than likely its because & is the HotKey signifier. How can I make it visible as &?


    -Lou

    {Hmmm, lets see, maybe look thru & turn off Hotkeying in the keys properties, hmmm}

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    In Classic VB ( ) you just set it to && instead, it's probably the same in .Newt

  3. #3

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    True. I think so too. However, then the button is Hot activated by pressing the keyboard key "&", and visually, the command button will have & underlined. Call me picky, but is there a way to do this without making & Hot?

    If not, I'll live with it, or perhaps make a bitmap array and use graphics, 1 per key.


    -Lou

  4. #4

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    Hmmm. Its NOT hot, nor is it underlined.

    VB Code:
    1. If 16 * MyI + MyJ = 38 Then
    2.     .Text = Chr(16 * MyI + MyJ) & Chr(16 * MyI + MyJ)
    3. Else
    4.     .Text = Chr(16 * MyI + MyJ)
    5. End If

    Thanks Si!


  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    I tried && and it neither activated on & nor did an underline appear.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    good stuff, same as b4 then.

    I love answering .Net questions (with VB6 answers!). never even seen .Net myself

  7. #7

  8. #8
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    If you are just amending the Text property of a button or a label then

    VB Code:
    1. .text="&" & chr(i)

    works perfectly OK without underlining ANY value of chr(i)


    but with the text of a textbox you only need

    VB Code:
    1. .text=chr(i)
    Last edited by taxes; May 14th, 2004 at 10:31 AM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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