CSV file help
Posted: Fri May 12, 2006 8:30 pm
Hi I'm currently loading a CSV file with each string seperated by "," and using a text gadget to display the text.
This is working fine with the CSV dile formated as follows
STRING 1,STRING 2,STRING 3,STRING 4
However the data I going to be using is formated as follows
STRING 1,STRING 2
STRING 3,STRING 4
When I load the CSV file formated like this the last two string only are displayed in the first two text gadgets only
Could someone please correct the code below or explain why this is happening.
Thanks
RIK
***************CODE**********************
If OpenWindow(0,0,0,400,200,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"TEST")
CreateGadgetList(WindowID(0))
If ReadFile(0,"c:\TEST.txt")
Repeat
TEXT$=ReadString()
Until Eof(0)
CloseFile(0)
EndIf
Dim TEXT$ (4):X=8
For I=1 To 4
TEXT$ (I)=StringField(TEXT$,I, ",")
StringGadget(I,8,X,306,20,TEXT$(I),#PB_String_UpperCase)
X=X+20
Next
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
This is working fine with the CSV dile formated as follows
STRING 1,STRING 2,STRING 3,STRING 4
However the data I going to be using is formated as follows
STRING 1,STRING 2
STRING 3,STRING 4
When I load the CSV file formated like this the last two string only are displayed in the first two text gadgets only
Could someone please correct the code below or explain why this is happening.
Thanks
RIK
***************CODE**********************
If OpenWindow(0,0,0,400,200,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"TEST")
CreateGadgetList(WindowID(0))
If ReadFile(0,"c:\TEST.txt")
Repeat
TEXT$=ReadString()
Until Eof(0)
CloseFile(0)
EndIf
Dim TEXT$ (4):X=8
For I=1 To 4
TEXT$ (I)=StringField(TEXT$,I, ",")
StringGadget(I,8,X,306,20,TEXT$(I),#PB_String_UpperCase)
X=X+20
Next
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf