steve potts

steve potts

  • NA
  • 29
  • 10.4k

check if array contains certain text, and if so, add the rows to listbox

Oct 19 2012 7:01 AM
hi again all!

last question i promise ;)

i need to check if a string variable exists inside of an array of data.

heres how i currently add., what i would like to do is add them only if the data i have in my string smsName is within that row... any ideas? thank!

            foreach (DataRow row in sentSMS.Rows)
            {
                string rows = string.Format("{0}:{1}:{2}", row.ItemArray[0], row.ItemArray[1], row.ItemArray[2]);

                ListViewItem item1 = new ListViewItem(row.ItemArray[0].ToString(), 0);

                item1.Checked = true;
                item1.SubItems.Add(row.ItemArray[1].ToString());
                item1.SubItems.Add(row.ItemArray[2].ToString());
                listView1.Items.Add(item1);

Answers (1)