Results 1 to 18 of 18

Thread: Add String with semicolon to a ListBox

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    9

    Add String with semicolon to a ListBox

    Is there a way of adding a semicolon to a listbox? Is there specific string (similar to vbcr) that would add a semicolon?
    Last edited by Hack; Apr 25th, 2006 at 09:29 AM.

  2. #2
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Add String with semicolon to a ListBox

    ?? u mean just adding a semi after the text?

    List1.Additem strItem & ";"
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

  4. #4
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Add String with semicolon to a ListBox

    isnt it this? Chr(59)

    Edit: ok just tested.. both work Chr("59") & Chr(59)....
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    9

    Re: Add String with semicolon to a ListBox

    Chr(59)... that's it. Thanks to everyone for their help.
    Last edited by rohcky; Apr 25th, 2006 at 07:37 AM.

  6. #6
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Add String with semicolon to a ListBox

    Quote Originally Posted by Static
    isnt it this? Chr(59)

    Edit: ok just tested.. both work Chr("59") & Chr(59)....
    yes, either are fine

  7. #7
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Add String with semicolon to a ListBox

    Quote Originally Posted by rohcky
    Chr(59)... that's it. Thanks to everyone for their help.

    @Static: Can't use ";" because semicolons are delimiters. It sees the semi and cuts off the rest of the text.
    if this thread has been resolved, please resolve thread for other members.

  8. #8

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    9

    Re: [RESOLVED] Add String with semicolon to a ListBox

    I thought that using this technique would work, but it did not. Is there a difference between standard VB and the VB used by Access when creating forms? I tried to add the semicolon and it did not work. It still cuts off any text found after the semicolon.

    Code similar to this:

    [listAddr].AddItem (<str> & <str> & Chr(59) & <str> & vbCrLf)

    Even when I try something simple like:

    [listAddr].AddItem (<str>) & Chr(59)

    it only stores the <str>.

  9. #9
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: [RESOLVED] Add String with semicolon to a ListBox

    check the properties of the Listbox...
    make sure u have it set to the correct number of columns.. and that the col widths are right
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  10. #10
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [RESOLVED] Add String with semicolon to a ListBox

    Quote Originally Posted by rohcky
    Is there a difference between standard VB and the VB used by Access when creating forms?
    Yes VB used by Access or Excel is called as VBA. try asking your question in the Office Development Section of VBF.
    Show Appreciation. Rate Posts.

  11. #11

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    9

    Re: [RESOLVED] Add String with semicolon to a ListBox

    Thanks, I'll try and see if I they have an answer over there.

    And thanks static, I changed the number columns to get around an error that I was having, but it still wouldn't let me add the semicolon to the string. Still considered it a delimiter.

  12. #12
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: [RESOLVED] Add String with semicolon to a ListBox

    well.. actually thats because in access it IS a delim.. for columns..
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  13. #13

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    9

    Store a string with a semi-colon in a ListBox

    Is it possible to do that? I know that Listboxes use semis as a delimiter. But the project that I am working on requires that I use a semicolon in the strings. So I need to store them.

    Is there a special way, like using ascii-like code, to store a semicolon-filled string in a ListBox?

  14. #14
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Add String with semicolon to a ListBox

    It would be better for the Office Development people to see what has already been suggested rather than start from scratch.

    Access VBA question moved to Office Development.

  15. #15
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Add String with semicolon to a ListBox

    u could store them a semicolon, but u wont be able to display them

    try displaying as a colon? : ? there is no way around this that I know of
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  16. #16

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    9

    Re: Add String with semicolon to a ListBox

    Quote Originally Posted by Static
    u could store them a semicolon, but u wont be able to display them

    try displaying as a colon? : ? there is no way around this that I know of
    Unfortunately I have to store and display the semi, otherwise there's no point in storing it. I have a work around to solve my problem, but was wondering if it's possible to do this for future reference.

  17. #17
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Add String with semicolon to a ListBox

    no.. u cant display ; in the standard access listbox or combobox.. it will always convert it to a delimiter for the combos columns...

    I couldnt find anything out on the net about changing it either. sorry
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  18. #18
    New Member
    Join Date
    Aug 2006
    Posts
    1

    Re: Add String with semicolon to a ListBox

    Hi All,
    I don't like the sound of that last reply Static
    I have the exact same problem and not much of a workaround.
    I need to display Khmer text in the combo box (yes I know...). I use Limon fonts which display Latin caracters using Khmer letters and unfortunatly, Khmer uses a lot of one caracter corresponding to the ";" Latin caracter and my application is widely based on Combo boxes.

    I tried a variety of combination and ended up with this:
    TEST_LIST4.addItem "1,""PasarGg,eKÝs"""

    I use "," as column separator and put the column value inside double quotes.
    I haven't implemented this yet because I read everywhere that semicolon should be used as column separator so I am not sure this would work. But on the test, the display of the combo is OK.

    What do you think ? Is this complete utopia or could this work ? Any issue you could think of when using comma as column separator ?

    Cheers,
    Jerome

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