Results 1 to 7 of 7

Thread: [RESOLVED] Checkbox.Text allowed characters?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Location
    North Texas
    Posts
    70

    Resolved [RESOLVED] Checkbox.Text allowed characters?

    Where can I find a list of allowed characters that can be displayed in the checkbox.text area. For instance, when the user enters "&" as part of the text for a checkbox, the "&" does not get displayed. So I want to filter these non-printing characters out of the string entered. Is there a list? Or, am I taking the wrong approach?
    Thanks,
    David

    How much deeper would the ocean be if sponges didn't grow there?

  2. #2
    Addicted Member
    Join Date
    Apr 2008
    Posts
    193

    Re: Checkbox.Text allowed characters?

    Are you talking about a textbox? As you do not enter text into a checkbox.
    As for the sponge question, it would be shallower, because they would not be there to displace water.
    ...
    If someone helps you, show it by rating their post!
    VB.net Code:
    1. ' These two lines will make your coding life much easier!
    2. Option Explicit On
    3. Option Strict On

    "Check everything. That's what software developers do." jmcilhinney

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Location
    North Texas
    Posts
    70

    Re: Checkbox.Text allowed characters?

    No, it is actually a checkbox. My program allows users to add new catagories which items can belong to. When a new catagory is added, I prompt the user in another form for the description of the new catagory. I then add a new checkbox control to the form and set its .text property to the string value entered by the user. The problem I am having is when a character is entered such as "&", it is displayed in the textbox where it is type, however, when I place that same text in the checkbox.text propery the "&" is replaced with "_". For instance, if the user enters "Bob & Dave" the checkbox label shows up as something like "Bob _Dave".

    Any help?
    Thanks,
    David

    How much deeper would the ocean be if sponges didn't grow there?

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Checkbox.Text allowed characters?

    Quote Originally Posted by DFarris View Post
    No, it is actually a checkbox. My program allows users to add new catagories which items can belong to. When a new catagory is added, I prompt the user in another form for the description of the new catagory. I then add a new checkbox control to the form and set its .text property to the string value entered by the user. The problem I am having is when a character is entered such as "&", it is displayed in the textbox where it is type, however, when I place that same text in the checkbox.text propery the "&" is replaced with "_". For instance, if the user enters "Bob & Dave" the checkbox label shows up as something like "Bob _Dave".

    Any help?
    Set the checkbox control UseMnemonic Property to False.

  5. #5
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    259

    Re: Checkbox.Text allowed characters?

    It is a little weird, but if you double the character, it removed the special functions, EG && litterally puts a ampersand in the text

    There is Edges idea if you don't want to use Mnemonic at all

  6. #6
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Checkbox.Text allowed characters?

    As Edgemeal's answer suggests it's not that the character is disallowed, it's that it's understood to be a HotKey (Alt + ) indicator as in all controls.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Location
    North Texas
    Posts
    70

    Re: Checkbox.Text allowed characters?

    Awsome! Setting the UseMnemonic Property to False did the trick! Thanks!!!
    Thanks,
    David

    How much deeper would the ocean be if sponges didn't grow there?

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