I was thinking about that too - in some of the custom grid controls i studied - they built in a function called load or import that would take a csv or xml file and import it into the sheet. But I don't know man ... the object model as it stands today is pretty powerfull and its only going to get better. Here's a script I've always wanted to write, you provide a path to a CSV file on the command line and it automatically builds a listview with column headers and everything. To use it, you just need to edit the csv file and put some header info on the first line. Hope this works for anyone that tries because im running the next maintenance build of forms (2.1.1).

You run it like this:

kix32 list.kix $filename=.\test.csv

[TEST.CSV]
code:
File,Date,Size,Version
"C:\WINNT\VMMREG32.DLL","1996/10/13 21:38:00","24336","4.00"
"C:\WINNT\CD32.EXE","2001/10/17 04:31:28","634087",""
"C:\WINNT\CLSPACK.EXE","2001/01/12 14:04:03","49424","5.00.3802"

and the code:

code:
;
; KIXTART 4.12
; KIXFORMS 2.1.0
;
; Accepts a command-line parameter called $filename that specifies the
; file to use. If not specified, looks for a file called TEST.CSV in
; current directory

break on

;
; usage: kix32 script [$filename="filename.csv"]
;

if not $filename
$filename = ".\test.csv"
endif

if not exist($filename)
?"$filename not found."
quit
endif

$form = createobject("kixtart.form")
$form.fontname = Verdana
$form.fontsize = 8
$form.clientsize = 800,600

$list = $form.listview
$list.location = 10,10
$list.width = $form.clientwidth - 20
$list.bottom = $form.clientheight - 20

if open(1,$filename) = 0
$titles = readline(1)
if $titles
for each $title in split($titles,",")
$list.columns.add.text = $title
next
endif
$line = readline(1)
while @error = 0
if $line
$item = $list.items.add
$fields = split($line,",")
for $i = 0 to ubound($fields)
if substr($fields[$i],1,1) = '"'
$fields[$i] = substr($fields[$i],2)
endif
if substr($fields[$i],len($fields[$i]),1) = '"'
$fields[$i] = substr($fields[$i],1,len($fields[$i])-1)
endif
$item.subitems($i).text = $fields[$i]
next
endif
$line = readline(1)
loop
if $list.items.count
for each $column in $list.columns
$column.width = -1
$column.width = -2
next
endif
$=close(1)
endif

$form.center
$form.show

while $form.visible
$=execute($form.doevents)
loop

exit 1



[ 09. October 2002, 17:02: Message edited by: Shawn ]