Results 1 to 5 of 5

Thread: Copy data from listview and paste in another listview on a different form

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    8

    Copy data from listview and paste in another listview on a different form

    Hi,

    I'm writing a program in visual basic 6, when data is displayed in a listview.
    I want to know, how can i copy that data and paste it in another listview on a different form.

    thanks in advance,

    cruzer

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    Re: Copy data from listview and paste in another listview on a different form

    Form2 code to copy data from a listview on Form1. (Untested)

    Code:
                   Dim itmX As ListItem 
                    Set itmX = F2Listview.ListItems.Add(, , Form1.F1Listview.SelectedItem.Text)
                    itmX.SubItems(1) = Form1.F1Listview.SelectedItem.Subitems(1)
                    itmX.SubItems(2) = Form1.F1Listview.SelectedItem.Subitems(2)

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    8

    Re: Copy data from listview and paste in another listview on a different form

    Hi,
    will this copy everything in the listview or just certain things?

    thanks,
    cruzer

  4. #4
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    Re: Copy data from listview and paste in another listview on a different form

    Code:
    Dim intI As Integer
    For intI = 1 To form1.ListView1.ListItems.Count
    
    Set itmX = form2.listview2.ListItems.Add(, , form1.ListView1.ListItems(intI))
        itmX.SubItems(2) = form1.ListView1.ListItems(intI).SubItems(2)     ' Copy all Subitems(2)
    Hi the above will copy all items, if you have more than one subitem just copy and paste the itmx.subitems(2) and change the 2 to a 3 for example e.t.c

  5. #5
    Registered User
    Join Date
    Mar 2014
    Posts
    1

    Re: Copy data from listview and paste in another listview on a different form

    hi there. im doing my project. saving data to textfile.
    so what i wanted to ask is that how could i transfer the data from one datagrid to another datagrid in other form .
    i have 1 datagrid in Form(Summaryofitempurchased)having 5 columns namely:Item,Price,Quantity,Day,Time . and another datagrid in Form(Receipt). i wanted the data Summaryofitempurchased transfer/copy to another datagrid IF AND only if the date today is equal to the date in the column of Summaryofitempurchased. how should i do that? please help? and the Receipt should save to textfile.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width