+ Reply to Thread
Results 1 to 2 of 2

problem about building a listbox from another list

Hybrid View

  1. #1
    Registered User
    Join Date
    05-24-2005
    Posts
    1

    problem about building a listbox from another list

    Hello, I am building a listbox from another list, but the following code doesn't work.

    ListBox2. AddItem ListBox1. Value

    Anyone could tell me why? Thanks in advance!

    Leon

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Leon,

    If the user has not selected an item in ListBox1, it's value is Null. Attempting to add this to ListBox2 is what causes an error. The AddItem method only accepts strings.

    If you want ListBox2 to be updated whenever an item in ListBox1 is selected, you need to place your code in the Click event for ListBox1.

    Code Example:

    Private Sub ListBox1_Click()

    ListBox2.AddItem ListBox1.Value

    End Sub


    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1