goodarziasl
دوشنبه 04 دی 1396, 19:31 عصر
سلام دوستان برنامه من قرار که از فایل تکس 1 خط به خط مقداری را برداره و توی فایل تکس دوم خط به خط جستجو کنه مشکل کدم اینجاست که از فایل تکس1 فقط خط اول را میخونه و سراغ خط دوم نمیره اینم کدم و ظاهرا فقط فایل تکس 2 را پیمایش میکنه راهنمایی کنید ممنون میشمTextWriter tw = new StreamWriter("d:\\file.txt"); try
{
FileStream str1 = new FileStream(txtPath.Text, FileMode.Open, FileAccess.ReadWrite);
StreamReader strreader1 = new StreamReader(str1);
FileStream str2 = new FileStream(txtPath2.Text, FileMode.Open, FileAccess.ReadWrite);
StreamReader strreader2 = new StreamReader(str2);
List<string> list = new List<string>();
string strf1 = "";
List<string> listf2 = new List<string>();
string strf2 = "";
while ((strf1 = strreader1.ReadLine()) != null)
{
list.Add(strf1);
try
{
while ((strf2 = strreader2.ReadLine()) != null)
{
listf2.Add(strf2);
if (strf1 == strf2)
{
MessageBox.Show(strf1 + "این شماره موجود است");
tw.WriteLine(strf1);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
{
FileStream str1 = new FileStream(txtPath.Text, FileMode.Open, FileAccess.ReadWrite);
StreamReader strreader1 = new StreamReader(str1);
FileStream str2 = new FileStream(txtPath2.Text, FileMode.Open, FileAccess.ReadWrite);
StreamReader strreader2 = new StreamReader(str2);
List<string> list = new List<string>();
string strf1 = "";
List<string> listf2 = new List<string>();
string strf2 = "";
while ((strf1 = strreader1.ReadLine()) != null)
{
list.Add(strf1);
try
{
while ((strf2 = strreader2.ReadLine()) != null)
{
listf2.Add(strf2);
if (strf1 == strf2)
{
MessageBox.Show(strf1 + "این شماره موجود است");
tw.WriteLine(strf1);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}