make a csv file and more coloms

Discussion in 'Questions (Windows Mobile)' started by sunnyboyj, Dec 11, 2007.

  1. sunnyboyj

    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
     
  2. specci48

    specci48 Well-Known Member Licensed 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
     

    Attached Files:

  3. sunnyboyj

    sunnyboyj Member

    Thanks, you are fast!
    I will try it with your suggestions
     
  4. sunnyboyj

    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)
     
  5. Rioven

    Rioven Active Member Licensed User

    Add quote marks for string cells...
    Table1.AddRow("artnr","porder","soortreg").
     
  6. sunnyboyj

    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....)
     
Loading...