5 Replies - 6106 Views - Last Post: 21 September 2010 - 01:04 AM Rate Topic: -----

#1 purple_jay  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 02-December 08

Copy all list items from one listview to another

Posted 19 September 2010 - 02:01 AM

Hi

I'm using listview to view the contents of my database.

Say i have one listview(lv1) in my frmSelectedServices and another listview(lv2) in my frmServicesRendered.
I just wanted to copy all the contents from lv1 to lv2. The only difference is that, the listviews are in 2 different forms.

I did something like this and obviously, it didn't work:

in frmSelectedServices
Private Sub cmdGetTotal_Click()

with frmServicesRendered
       .lv2.ListItems = lv1.ListItems
       .Show 1

End with


How do fix it? 





Thanks. :)
End Sub

This post has been edited by purple_jay: 19 September 2010 - 02:03 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Copy all list items from one listview to another

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,768
  • Joined: 26-March 09

Re: Copy all list items from one listview to another

Posted 19 September 2010 - 02:13 AM

I'm not sure if you can just copy the listitems like that even if they are on the same form.

You may need to look at looping through the listitems on form1 on the form2_load event (assuming you need to show them as soon as the form is loaded).
Was This Post Helpful? 1
  • +
  • -

#3 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Copy all list items from one listview to another

Posted 19 September 2010 - 02:18 AM

View Postmaj3091, on 19 September 2010 - 01:58 PM, said:

I'm not sure if you can just copy the listitems like that even if they are on the same form.

You may need to look at looping through the listitems on form1 on the form2_load event (assuming you need to show them as soon as the form is loaded).


You need the knowledge of for each ...in ... next
Was This Post Helpful? 0
  • +
  • -

#4 purple_jay  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 02-December 08

Re: Copy all list items from one listview to another

Posted 19 September 2010 - 04:37 AM

Oh there. I got it!!

Yeah, you guys are right. I should use For each so that I could load every element into the other listbox.

Thanks!! ^^,
Was This Post Helpful? 0
  • +
  • -

#5 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Copy all list items from one listview to another

Posted 19 September 2010 - 04:52 AM

View Postpurple_jay, on 19 September 2010 - 04:22 PM, said:

Oh there. I got it!!

Yeah, you guys are right. I should use For each so that I could load every element into the other listbox.

Thanks!! ^^,


Ok I hope you have got it and thanks by pressing + sign to gie credit to my post
This helps us begginers to continue
Was This Post Helpful? 1
  • +
  • -

#6 purple_jay  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 02-December 08

Re: Copy all list items from one listview to another

Posted 21 September 2010 - 01:04 AM

@smohd: There you go :) Thanks again!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1