المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : The best way to achive this ?



C# Programming
06-24-2009, 09:11 PM
Hell c# gurus , I am new to C# and im have a general question about c#

I have a datagrid , a text file full of urls and a string . Now the string is actuly the live data output of a program .

Ive already have written the code to import the entire text file into my data grid , What i would like to do is while importing the urls in the foreach loop check the value of s and see if it occurs anywhere in the live output string the value of the string t changes to pending .

Is there anyway to do this ?

const string fName = @"1.txt";
string[] lines = File.ReadAllLines(fName);
List fields = new List();
foreach (string s in lines)
{
int n = dataGridView1.Rows.Add();

dataGridView1.Rows[n].Cells[0].Value = s;
dataGridView1.Rows[n].Cells[1].Value = t;
}