Sign in to follow this  
Followers 0
Toine

Load a CVS fils in a ListView

3 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks for all, I will try that soon

Share this post


Link to post
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
Sign in to follow this  
Followers 0