make a csv file and more coloms

sunnyboyj

Member
I am able to write a file. For this example I write the value porder and soortreg to the oee.csv file. How do I make a 'real' csv file and more important how do I make coloms:

i now have a file what looks like:
porder
soortreg
porder2
soortreg2

I want to have the file looks like:
porder,soortreg
porder2,soortreg2

___
sub btnoeereg_Click
' ErrorLabel(errSaveINI)
FileOpen( c1,"oee.csv",cwrite,cAppend)
FileWrite(c1,porder.Text)
FileWrite(c1,soortreg.Text)
FileClose(c1)
Return'If there were no "Return" here, the error message would have shown.
errSaveINI:
Msgbox("Error writing INI file.","",cMsgboxOK,cMsgboxHand)
FileClose(c1)
End Sub
 

specci48

Well-Known Member
Licensed User
Longtime User
Hi sunnyboyj,

you should use a table to save your data.
I added an example of creating a small table and saving it to csv (one time with and on time without a header).
If you want to use a table as an "internal storage", you can set the visible property to false.


specci48
 

Attachments

  • SaveCsv.sbp
    949 bytes · Views: 193

sunnyboyj

Member
I understand the addcol and addrow now, thanxs! But how do I save the information from button artnr, porder and soortreg into the file (I thought it would work like this, but it does not). Also I want to 'append' the file when generating more info by pressing the OK button.

Table1.AddCol(cString, "Artnr", 50)
Table1.AddCol(cString, "Porder", 50)
Table1.AddCol(cString, "Soortreg", 50)
Table1.AddRow(artnr,porder,soortreg)
Table1.SaveCSV("WithoutHeader.csv", ",", False)
 

Rioven

Active Member
Licensed User
Longtime User
Add quote marks for string cells...
Table1.AddRow("artnr","porder","soortreg").
 

sunnyboyj

Member
Thanks for your response!
I have checked it and worked out that I have to use:
Table1.AddRow(porder.text,soortreg.text etc.etc....)
 
Top