Hello. I've read many posts regarding populating userform controls from listboxes and the below code is about as generic as you can get. The example below is for a listbox that is rowsourced in the vb properties window. I've tried other code that uses vb to source the data. The multicolumn listbox populates correctly on initialization. However, when I run the click event on my form, it has a run-time errror (could not get the list property. Invalid argument) on line #3. The combo and textbox names are correct as is the listbox name.
Like I've said, I've tried a variety of other methods found in every forum I can find, and found that the syntax seems to be correct, but I continue more often than not to get the same run-time error. I can only assume this is a problem created by how the listbox was sourced when initialized, but that to me doesn't seem like it would matter. I have been beating my head on this for days and cannot seem to figure this out. It seems so simple by looking at other posts! If there is a caveat with initialization, I can post the code used for that procedure if needed.
Private Sub Listbox1_Click()
cbTextBox1.Text = Me.Listbox1.List(Listbox1.ListIndex, 3)
txtTextBox2.Text = Me.Listbox1.List(Listbox1.ListIndex, 4)
txtTextBox3.Text = Me.Listbox1.List(Listbox1.ListIndex, 5)
End Sub
Bookmarks