这是个邮件接收程序中的点击阅读邮件部分的代码,
其中着一样提示
if (str1.Trim().Length != 0)
提示System.Array并不包含Trim的定义这一行提示
if (str1.Substring(0, 2).ToLower() == "to")
System.Array并不包含Substring的定义请问这个该怎么修改啊
按钮相应时间代码如下:String strTemp;
content = "";
this.richTextBox1.Clear();
try
{
string str = this.listBox1.SelectedItem.ToString();
str = str.Substring(1, str.IndexOf("封") - 1);
Data = "RETR " + str;
sw.WriteLine(Data);
sw.Flush();
strTemp = sr.ReadLine();
if (strTemp[0] != '-')
{
while (strTemp != ".")
{
content += strTemp + CRLF;
strTemp = sr.ReadLine();
}
}
else
{
this.listBox2.Items.Add(strTemp);
}
char[] seperator = { '\n' };
string[] str1 = content.Trim().Split(seperator);
for (int i = 0; i <= 9; i++)
{
if (str1.Trim().Length != 0)//这一行有错误 提示System.Array并不包含Trim的定义
{
if (str1.Substring(0, 2).ToLower() == "to")//这一行的错误提示 System.Array并不包含Substring的定义
{
this.richTextBox1.Text += "发送到" + str1.Substring(2, str1.Length - 2);
}
if (str1.Substring(0, 4).ToLower() == "from")
{
this.richTextBox1.Text += "来自" + str1.Substring(4, str1.Length - 4);
}
if (str1.Substring(0, 7).ToLower() == "subject")
{
this.richTextBox1.Text += "标题" + str1.Substring(7, str1.Length - 7);
}
if (str1.Substring(0, 4).ToLower() == "date")
{
this.richTextBox1.Text += "日期" + str1.Substring(4, str1.Length - 4);
}
}
}
this.richTextBox1.Text += "内容: " + CRLF;
for (int j = 12; j < str1.Length; j++)
{
if (str1[j].Trim().Length != 0)
{
this.richTextBox1.Text += str1[j];
}
}
}
catch
{
this.listBox2.Items.Add("ERROR!");
}请大家帮下忙,谢谢
其中着一样提示
if (str1.Trim().Length != 0)
提示System.Array并不包含Trim的定义这一行提示
if (str1.Substring(0, 2).ToLower() == "to")
System.Array并不包含Substring的定义请问这个该怎么修改啊
按钮相应时间代码如下:String strTemp;
content = "";
this.richTextBox1.Clear();
try
{
string str = this.listBox1.SelectedItem.ToString();
str = str.Substring(1, str.IndexOf("封") - 1);
Data = "RETR " + str;
sw.WriteLine(Data);
sw.Flush();
strTemp = sr.ReadLine();
if (strTemp[0] != '-')
{
while (strTemp != ".")
{
content += strTemp + CRLF;
strTemp = sr.ReadLine();
}
}
else
{
this.listBox2.Items.Add(strTemp);
}
char[] seperator = { '\n' };
string[] str1 = content.Trim().Split(seperator);
for (int i = 0; i <= 9; i++)
{
if (str1.Trim().Length != 0)//这一行有错误 提示System.Array并不包含Trim的定义
{
if (str1.Substring(0, 2).ToLower() == "to")//这一行的错误提示 System.Array并不包含Substring的定义
{
this.richTextBox1.Text += "发送到" + str1.Substring(2, str1.Length - 2);
}
if (str1.Substring(0, 4).ToLower() == "from")
{
this.richTextBox1.Text += "来自" + str1.Substring(4, str1.Length - 4);
}
if (str1.Substring(0, 7).ToLower() == "subject")
{
this.richTextBox1.Text += "标题" + str1.Substring(7, str1.Length - 7);
}
if (str1.Substring(0, 4).ToLower() == "date")
{
this.richTextBox1.Text += "日期" + str1.Substring(4, str1.Length - 4);
}
}
}
this.richTextBox1.Text += "内容: " + CRLF;
for (int j = 12; j < str1.Length; j++)
{
if (str1[j].Trim().Length != 0)
{
this.richTextBox1.Text += str1[j];
}
}
}
catch
{
this.listBox2.Items.Add("ERROR!");
}请大家帮下忙,谢谢
解决方案 »
- 怎么判断winform窗体有对话框?
- Winform使用webbrowser控件执行js函数问题求高手指教!
- 如何实现定点循环··
- 请教,TFS怎么跟踪工作项?例如,我新建一个‘任务’给成员A,为什么A在‘所有任务’或‘我的工作项’中看不到啊
- [请教!]做一个自动注册网站用户的工具都有那些方法?
- 请教C#开发可在线检查并自动更新的程序的原理
- 求解释输出(与预期不一致)
- 新手一段小代码不太理解,大家帮忙看一下
- 【高分】求c#特效界面!!!
- 请问在C#winform中如果不用DataGrid那么可以利用什么控件来替代它而且比它的功能更强大?
- 有没有简单的例子 结合c# 和sql的
- 请问如何更新Windows Service?
str1[0] OK?