Valhalla Legends Forums Archive | Visual Basic Programming | List View help....

AuthorMessageTime
OuTLawZGoSu
Aight, I got 2 forms. on each one I got a listview. (Form1 got List1 and Form2 got List2) This is wat I need.

When I press a button on Form1, it loads Form2. When Form2 loads, everything in Form1.List1 goes to Form2.List2. When Form2.List2 is unloaded, everything in List2 goes to List1.

Help?
December 22, 2003, 10:02 PM
Null
[code]For I = 1 to Form1.Listview1.Listitems.Count
Form2.Listview2.Listitems.Add I
Next I[/code]
December 22, 2003, 10:22 PM
OuTLawZGoSu
Wtf?

[code]

Private Sub Form_Load()

For i = 1 To Form1.ChannelList.ListItems.Count
Rechlist.ChannelList.ListItems.add i
Next i

[/code]

It highlights " i " and sais, " Variable Not Defined "

If I type in " Dim i As String ", it highlights " i " and sais, " Type Missmatch "

Dono why it does this.

Help?
December 22, 2003, 10:31 PM
Null
[code]Dim I as Integer[/code]

Edit * The code supplied MAY NOT be everything u need to accomplish your task but just an idea you can use to further implement what your looking to do.

Also seeing how u didnt know how to declare an integer im suggesting you go off and actually learn Visual Basic
December 22, 2003, 10:32 PM
OuTLawZGoSu
[quote author=NuLL link=board=31;threadid=4399;start=0#msg36810 date=1072132357]
... actually learn Visual Basic
[/quote]

There is no way you can Learn Vb. There are about a billion parts of it.

Im open for suggestions.
December 22, 2003, 10:45 PM
Null
Jump of a cliff
December 22, 2003, 10:51 PM
CrAz3D
[quote author=OuTLawZGoSu link=board=31;threadid=4399;start=0#msg36812 date=1072133130]
[quote author=NuLL link=board=31;threadid=4399;start=0#msg36810 date=1072132357]
... actually learn Visual Basic
[/quote]

There is no way you can Learn Vb. There are about a billion parts of it.

Im open for suggestions.

[/quote]
You can't learn vb?...hmm, interesting theory.

December 24, 2003, 2:14 AM
kamakazie
[quote author=OuTLawZGoSu link=board=31;threadid=4399;start=0#msg36812 date=1072133130]
There is no way you can Learn Vb. There are about a billion parts of it.
[/quote]

So you've counted them all...interesting. I'm sure if you have that much time on your hands you can learn the language as well.
December 24, 2003, 3:37 AM
OuTLawZGoSu
Aight, don't post if it ain't useful.
December 24, 2003, 8:10 PM
Null
[quote author=OuTLawZGoSu link=board=31;threadid=4399;start=0#msg36812 date=1072133130]

there is no way you can Learn Vb. There are about a billion parts of it.

Im open for suggestions.

[/quote]

take some of your own advice
December 24, 2003, 10:39 PM
______
[quote author=OuTLawZGoSu link=board=31;threadid=4399;start=0#msg36806 date=1072130557]
Aight, I got 2 forms. on each one I got a listview. (Form1 got List1 and Form2 got List2) This is wat I need.

When I press a button on Form1, it loads Form2. When Form2 loads, everything in Form1.List1 goes to Form2.List2. When Form2.List2 is unloaded, everything in List2 goes to List1.

Help?
[/quote]

Hope this helps.


[code]
under
Public sub YourButton_click
Dim i As Integer
For i = 1 To List1.ListItems.Count
Form2.List2.ListItems.Add , , List1.ListItems(i).Text
Next i
Form2.Show
end sub


'Form2 unload
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
For i = 1 To List2.ListItems.Count
Form1.List1.ListItems.Add , , List2.ListItems(i).Text
Next i
End Sub
[/code]

Edit: (Grok) Added indentions. If ListView is 0-based, you'll want to go For i = 0 to ListItems.Count - 1 as well. I don't remember at the moment and haven't time to look it up.
December 29, 2003, 9:10 PM

Search