English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i am practicing in visual basic programming, i am not able to move data or information from one list to another.

2007-02-10 15:40:16 · 2 answers · asked by C E 1 in Computers & Internet Programming & Design

Thanks for your helpful answers; I still need to use 'selected' property to choose some items in list1 to be moved to list2; once I use it I get stopped in run time and the program doesn't continue.

2007-02-11 21:56:20 · update #1

2 answers

This example has a "List1" & "List2" Listbox controls and a "Command1" Button.

5 elements are added to "List1" when form its loaded.
"List2" its loaded with all the elements from "List1".

(Method "Additem" its used to add items to a ListBox control)


Private Sub Form_Load()
List1.Clear
List1.AddItem "One"
List1.AddItem "Two"
List1.AddItem "Three"
List1.AddItem "Four"
List1.AddItem "Five"
End Sub

Private Sub Command1_Click()
Dim nIndex As Integer

List2.Clear
For nIndex = 0 To List1.ListCount - 1
List2.AddItem List1.List(nIndex)
Next nIndex
End Sub

2007-02-10 17:06:40 · answer #1 · answered by Anonymous · 0 0

For t = 0 To List1.ListCount - 1
List1.ListIndex = t
List2.AddItem List1.Text
Next t

Have fun.....

2007-02-11 00:58:24 · answer #2 · answered by Syntax Wizard 2 · 0 0

fedest.com, questions and answers