Results 1 to 6 of 6

Thread: [RESOLVED] listview export

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2013
    Posts
    18

    Resolved [RESOLVED] listview export

    i know i am being stupid here so i apologies before we start!

    Trying to export a list view to a csv but i need it to export in an order, how do i change the count to run 5, 2, 3, 4??

    Code:
        
     For i As Integer = 0 To lv.Items.Count - 1
        For j As Integer = 0 To lv.Columns.Count - 1
            os.Write("""" & lv.Items(i).SubItems(j).Text.Replace("""", """""")+ """,")
         Next
         os.WriteLine()
     Next
     os.Close()

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: listview export

    Code:
    Dim columnIndexes As Integer() = New Integer() {5, 2, 3, 4}
    
    For Each columnIndex In columnIndexes

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2013
    Posts
    18

    Re: listview export

    Quote Originally Posted by jmcilhinney View Post
    Code:
    Dim columnIndexes As Integer() = New Integer() {5, 2, 3, 4}
    
    For Each columnIndex In columnIndexes

    sorry i'm being idiotic here!

    how would i use that? could you show me an example?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: listview export

    It's a loop that provides you with column indexes. You already know what to do with such a loop because you've already got one in your code. The difference is that this one gives you the values you want in the order you want them instead of all the values in ascending order.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2013
    Posts
    18

    Re: listview export

    Quote Originally Posted by jmcilhinney View Post
    It's a loop that provides you with column indexes. You already know what to do with such a loop because you've already got one in your code. The difference is that this one gives you the values you want in the order you want them instead of all the values in ascending order.
    Yes i presumed that and but the column index is not a value of the listview or of the outfile?
    so For Each columnIndex gives me an error on its own?

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Feb 2013
    Posts
    18

    Re: listview export

    nevermind i got it in the end!

    thanks

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