Jump to content

Load a CVS fils in a ListView


Toine
 Share

Recommended Posts

Is there a single way to load a Comma Separated File into a ListView

for example the file contains this 3 lines

a1,b1,c1,d1

a2,b2,c2,d2

a3,b3,c3,d3

And I want one value per cell.

Col1 Col2 Col3 Col4

a1 b1 c1 d1

a2 b2 c2 d2

a3 b3 c3 d3

In the same way is there a single way to save the contents of a ListView in et CVS file.

Thanks for your help

Link to comment
Share on other sites

maybe...

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF)  ; will change background color

$listview = GUICtrlCreateListView ("col1|col2|col3|col4",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Exit",75,170,70,20)
GUISetState()


; READ YOUR DATA FROM A FILE
; _FileReadToArray() - see help

; for this demo 
Dim $File_Read[4]
Dim $list_Item[UBound($File_Read)]

$File_Read[1] = "a1,b1,c1,d1"
$File_Read[2] = "a2,b2,c2,d2"
$File_Read[3] = "a3,b3,c3,d3"

for $x = 1 to UBound($File_Read) - 1
    
    $info = StringReplace($File_Read[$x], ",", "|")
    
    
    $list_Item[$x] = GUICtrlCreateListViewItem( $info,$listview)
Next


Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         Exit
     Case Else
         ;
   EndSelect
Until $msg = $GUI_EVENT_CLOSE

8)

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...