G
gwenna
I have problem.
I am reading a text file using a streamreader and I want to check if a
field in the line I'm reading is the same as one in the line previously
read before doing something but .. when the line I'm reading is the
first line, I get an error... How can I check that the previous line
exists?
So far I have
using (StreamReader sr = new StreamReader(F))
while((line = sr.ReadLine())!= null)
{
checkPolicy = line.Substring(13,11);
if checkPolicy = polDS.Policy[0].POLICYNUM
{
// do this
}
else
{
// do that
}}
I am reading a text file using a streamreader and I want to check if a
field in the line I'm reading is the same as one in the line previously
read before doing something but .. when the line I'm reading is the
first line, I get an error... How can I check that the previous line
exists?
So far I have
using (StreamReader sr = new StreamReader(F))
while((line = sr.ReadLine())!= null)
{
checkPolicy = line.Substring(13,11);
if checkPolicy = polDS.Policy[0].POLICYNUM
{
// do this
}
else
{
// do that
}}