LoadCSV from a variable

Discussion in 'Questions (Windows Mobile)' started by nsidney, Jan 29, 2008.

  1. nsidney

    nsidney Member Licensed User

    I would like to load CSV data from a webresponse variable into a ListBox, but I get the error "Object reference not set to an instance of the object." Is there a way around this?


    Response.Value = Request.GetResponse
    result = Response.GetString
  2. Cableguy

    Cableguy Expert Licensed User

    What is the tipe of the "Response" control?
    Does the getresponse statements retrieve any result?
  3. nsidney

    nsidney Member Licensed User

    the "result" is the result of a WebReponse function and data is actually returned successfully (I verified that with a msgBox that displays the value of "result").

  4. Cableguy

    Cableguy Expert Licensed User

    These are the properties and methods supported by a listbox...

    The is no loadcsv method in a listbox, but there is one tablecontrol...
    Properties and Methods:
    Wich you can read and populate the listbox...
  5. nsidney

    nsidney Member Licensed User

    Oops... didn't notice the difference there ;).

    Ok so when I changed it into a Table control, it thinks "result" is the name of the file. How can I take "response" and feed that into a file and then send that file name to this LoadCSV function?

  6. nsidney

    nsidney Member Licensed User

    Or... is there an easier way to loop through CSV data and add each row to the table (or a listbox)?
  7. Cableguy

    Cableguy Expert Licensed User

    Were does the data came from? a file or from a web site?
    If all the data cames in a simple string with a know separator you can use StrSplit

  8. alfcen

    alfcen Well-Known Member Licensed User

    Hi nsidney,

    If the expected data amount in 'result' is small then please try this way:

    Response.Value = Request.GetResponse
    result = Response.GetString

    FileOpen(c1,AppPath & 

    Table1.LoadCSV(AppPath & 
    You can then populate a listbox or a combobox from the table with the
    added advantage of having a backup file of the downloaded data.