Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: OuTLawZGoSu on December 22, 2003, 04:02 PM

Title: List View help....
Post by: OuTLawZGoSu on December 22, 2003, 04:02 PM
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?
Title: Re:List View help....
Post by: effect on December 22, 2003, 04:22 PM
For I = 1 to Form1.Listview1.Listitems.Count
        Form2.Listview2.Listitems.Add I
Next I

Title: Re:List View help....
Post by: OuTLawZGoSu on December 22, 2003, 04:31 PM
Wtf?



Private Sub Form_Load()

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



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?
Title: Re:List View help....
Post by: effect on December 22, 2003, 04:32 PM
Dim I as Integer

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
Title: Re:List View help....
Post by: OuTLawZGoSu on December 22, 2003, 04:45 PM
Quote from: NuLL on December 22, 2003, 04:32 PM
... actually learn Visual Basic

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

Im open for suggestions.
Title: Re:List View help....
Post by: effect on December 22, 2003, 04:51 PM
Jump of a cliff
Title: Re:List View help....
Post by: CrAz3D on December 23, 2003, 08:14 PM
Quote from: OuTLawZGoSu on December 22, 2003, 04:45 PM
Quote from: NuLL on December 22, 2003, 04:32 PM
... actually learn Visual Basic

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

Im open for suggestions.

You can't learn vb?...hmm, interesting theory.

Title: Re:List View help....
Post by: dxoigmn on December 23, 2003, 09:37 PM
Quote from: OuTLawZGoSu on December 22, 2003, 04:45 PM
There is no way you can Learn Vb. There are about a billion parts of it.

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.
Title: Re:List View help....
Post by: OuTLawZGoSu on December 24, 2003, 02:10 PM
Aight, don't post if it ain't useful.
Title: Re:List View help....
Post by: effect on December 24, 2003, 04:39 PM
Quote from: OuTLawZGoSu on December 22, 2003, 04:45 PM

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

Im open for suggestions.


take some of your own advice
Title: Re:List View help....
Post by: ______ on December 29, 2003, 03:10 PM
Quote from: OuTLawZGoSu on December 22, 2003, 04:02 PM
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?

Hope this helps.



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


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.