Results 1 to 2 of 2

Thread: ListView help

  1. #1

    Thread Starter
    Lively Member JAtkinson's Avatar
    Join Date
    Feb 2004
    Location
    Richmond, VA
    Posts
    68

    ListView help

    I have some strings that Im trying to delimit by "," and "*". How can I put the delimited string arrays into separate columns in a list view?


    VB Code:
    1. string nmea;
    2. string [] nmeaSplit;
    3.  
    4. private void tmrReadNmea_Tick(object sender, System.EventArgs e)
    5.         {
    6.            
    7.             lbxNmea.Items.Add(objReader1.ReadLine().ToString());
    8.             nmea = objReader1.ReadLine().ToString();
    9.             delimitNmea();
    10.         }
    11.  
    12.         public void delimitNmea()
    13.         {
    14.                    
    15.             nmeaSplit = nmea.Split(new Char [] {',','*'});
    16.            
    17.             foreach (string s in nmeaSplit)
    18.             {
    19.                
    20.                 listViewNmea.Items.Add(s); ' this is wrong
    21.                
    22.  
    23.             }

    Thanks,
    James
    Visual Studio .net 2003 EA
    VB .net
    C#

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    foreach (string s in nmeaSplit)
    {

    ListViewItem lvi = new ListViewItem();
    lvi.SubItems.Add(s);
    listViewNmea.Items.Add(lvi);
    }

    you have to fill out ListViewItem objects then add those to your list view.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width