询问各位高手为什么我再向listbox中添加新元素的时候系统会在 beginupdate() 那行报错while (Is_Connect)
{
string msg = reader.ReadLine(); if (msg.IndexOf("++*") != -1)
{
User_List_Add(msg);
Is_System = true;
}
}
private void User_List_Add(string msg)
{ string user = null;
foreach (char s in msg)
{
if(s!='*'&&s!='+')
{
user+=s;
}
}
User_List.BeginUpdate(); //=========================报错
User_List.Items.Add(user);
User_List.EndUpdate();
}
{
string msg = reader.ReadLine(); if (msg.IndexOf("++*") != -1)
{
User_List_Add(msg);
Is_System = true;
}
}
private void User_List_Add(string msg)
{ string user = null;
foreach (char s in msg)
{
if(s!='*'&&s!='+')
{
user+=s;
}
}
User_List.BeginUpdate(); //=========================报错
User_List.Items.Add(user);
User_List.EndUpdate();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货