Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: ListBox (parsing?)

    In my listbox, I'm displaying multiple rows of the following [it's the result of a query sent to Oracle]:

    ListBox.AddItem rs("city") & (" ") & rs("phone")

    When the user clicks on the ListBox, I would like to have just "city" (not "phone") of that particular selected entry displayed on Label1.Caption. How can I do that? Please help. Thanks.

    P.S. Label1.Caption = ListBox.Text OR Label1.Caption = ListBox.List(ListBox.ListIndex) would display both "city" and "phone" in the caption...I would like to display just the "city". Thanks.

  2. #2
    Join Date
    Feb 2002
    If the format of the listbox item is "city name XXX-XXX-XXXX" - meaning no spaces in the phone number, you can use the following:

    strTest = "San Jose 213-222-1212"
    MsgBox Left(strTest, Len(strTest) - InStr(1, StrReverse(strTest), " "))

Posting Permissions

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