在执行过程中读取文本文件... crashid [英] reading text file ... crashid during execute
本文介绍了在执行过程中读取文本文件... crashid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您能在这里看到任何错误吗?
我使用unicode
和具有dat文件扩展名的firstget文件,并更改为txt
can u see any wrong here ?
i use unicode
and firstget file with dat File extension and change to txt
if (textBox1.Text != "" && textBox2.Text!="" && textBox3.Text!="" && textBox15.Text!=""&& txtdate1.Text!="")
{
string Rline;
string temp;
string[] dtemp;
DateTime InDate = DateTime.Now;
// reading file
string dir = Directory.GetCurrentDirectory();
string MyPath = System.IO.Path.Combine(dir, textBox3.Text.ToLower());
StreamWriter filewrite = new StreamWriter(@MyPath + ".txt",true, Encoding.Unicode);
// Read the file and display it line by line.
if (!File.Exists(@op.FileName.ToString().Replace("dat", "txt")))
File.Copy(@op.FileName.ToString(), @op.FileName.ToString().Replace("dat", "txt"));
StreamReader Readfile = new StreamReader(@op.FileName.ToString().Replace("dat", "txt"));
dtemp = txtdate1.Text.Split('/');
InDate = shamsi2Miladi.shamsi2miladi(Convert.ToInt32(dtemp[0]),Convert.ToInt32(dtemp[1]),Convert.ToInt32(dtemp[2]));
MessageBox.Show(InDate.ToString());
// Erorr Here Help Help
while ((Rline = Readfile.ReadLine()) != null)
{
temp = Rline;
temp = temp.Substring(1, 5).Replace(" ", string.Empty);
MessageBox.Show(temp.Substring(6, 10));
if (Convert.ToInt32(temp) == Convert.ToInt32(textBox3.Text) && Convert.ToDateTime(temp.Substring(6, 10)) >= InDate)
{
filewrite.WriteLine(Rline);
}
}
progressBar1.Value = 20;
Readfile.Close();
filewrite.Close();
progressBar1.Value = 100;
MessageBox.Show("گزارش به اتمام رسید ");
textBox2.Text = "";
textBox3.Text = "";
}
else
{
MessageBox.Show("لطفا فیلد های داده شده تکمیل نمایید ");
}
请检查这张图片
http://uploadfa.net/uploads/13539564541.png [ www.winmaildat.com/getfile.php?getfile=%2Ftnefhandlerp2UMOx%2Fwinmail.dat [ ^ ]
plz check this picture
http://uploadfa.net/uploads/13539564541.png[^]
it''s my file
www.winmaildat.com/getfile.php?getfile=%2Ftnefhandlerp2UMOx%2Fwinmail.dat[^]
推荐答案
if (Convert.ToInt32(temp) == Convert.ToInt32(textBox3.Text) && Convert.ToDateTime(temp.Substring(6, 10)) >= InDate
这是问题,我更改了温度,然后想要选择子字符串,我将其更改为
it was problem i changed temp and then want to pick substring i change it to
if (Convert.ToInt32(temp) == Convert.ToInt32(textBox3.Text) && Convert.ToDateTime(Rline.Substring(6, 10)) >= InDate)
这篇关于在执行过程中读取文本文件... crashid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文