PDA

Click to See Complete Forum and Search --> : Message for MartinLiss


hlieu
May 23rd, 2000, 06:43 AM
Hi MartinLiss,

Thank you very much for your help. It works great.
But I still have one problem, wonder if you can help.

Three listboxes list1, list2 and list3. list1 contains first name and last name "John,Smith". I would like to transfer first name to list2 and last name to list3. In other words, at one click of the button, "John" would go to list2 and ",Smith" would go list3.


Thank you very much Master.








Hi Masters,


Is there a way to make part of the item in the listbox invisible?

I have a listbox containing first name and last name "John,Smith". The question is how to make "Smith" invisible, and that gose for all last names in the listbox.

Remember, Just invisible only not delete it or anything lake that. Because I'd like to be able to write both names(first and last)in to table(this part I know how to do).


Thank you Masters.



MartinLiss
Guru

Registered: Sep 1999
Posts: 1152
Create a second ListBox for the form and set its Visible property to False. Then store only the first name in the original ListBox and store the last name in the new ListBox. You will then need to do things to synchronize the two listboxes like adding code to the Click event of List1 that says

List2.ListIndex = List1.ListIndex

MartinLiss
May 23rd, 2000, 09:47 AM
Here's a modification that will do what you want.

Dim MyArray(2) As String
Dim ResultArray() As String
Dim intIndex As Integer

MyArray(0) = "Smith, John"
MyArray(1) = "Jones, E."
MyArray(2) = "Liss"

List1.AddItem MyArray(0)
List1.AddItem MyArray(1)
List1.AddItem MyArray(2)

On Error GoTo ErrorRoutine
For intIndex = 0 To 2
ResultArray() = Split(MyArray(intIndex), ",")
List2.AddItem ResultArray(1)
List3.AddItem ResultArray(0)
Next

Exit Sub

ErrorRoutine:

If Err.Number = 9 Then
List2.AddItem ""
Resume Next
Else
MsgBox Err.Description
End If


P.S. If you want to catch my attention, you are better off emailing me than posting "Message for MartinLiss" messages,