Reading text into listview?

Discussion in 'Programming & Scripting' started by tOxiC x, Jan 27, 2009 with 6 replies and 265 views.

  1. tOxiC x

    tOxiC x Member

    Messages:
    656
    Ratings:
    116
    In this app I basically want to navigate to a text file on the web ([Click here to view the link]) and start reading the data 4 lines down into the listbox. I want it to read the first 10 characters(of each line) to column 1 and the rest of the characters (on each line) to column 2. I have started some code, but it needs a lot of work, here is what it is:

    I didn't add the stream reader yet because I really didn't know how to go about doing so on the specifications on how I need it.
     
  2. GoldBl4d3

    GoldBl4d3 Retired Retired

    Messages:
    3,758
    Ratings:
    1,328
    k
    look, dont do this okay:

    ListViewItem lvi = new ListViewItem();
    lvi.SubItems.Add(date);
    lvi.SubItems.Add(rls);

    do it like this:

    ListViewItem lvi = new ListViewItem();
    lvi.Text = (date);
    lvi.SubItems.Add(rls);
     
    • Like Like x 1
  3. superaison

    superaison Banned

    Messages:
    1,404
    Ratings:
    269
    ^^ Good, but not good enough.


    ListViewItem lvi = new ListViewItem(date);
    lvi.SubItems.Add(rls);
    listView1.Items.Add(lvi);

    :wink:

    Good luck, happy coding.
     
  4. GoldBl4d3

    GoldBl4d3 Retired Retired

    Messages:
    3,758
    Ratings:
    1,328
    thats not better. Its called style of programming. Not everyone programs like that. So it is not better.
     
  5. OP
    tOxiC x

    tOxiC x Member

    Messages:
    656
    Ratings:
    116
    The main thing is, I get the listview, but can you guys help me with setting up reading the strings...
     
  6. superaison

    superaison Banned

    Messages:
    1,404
    Ratings:
    269


    Reading strings from a listview?


    Code:
    listView1.FocusedItem.SubItems[0].Text
     
  7. OP
    tOxiC x

    tOxiC x Member

    Messages:
    656
    Ratings:
    116
    No, I'm sorry for the misinterpretation.. I meant reading the strings from the webpage like the first 10 char = column 1 and the rest of the characters on the line = column 2.