解决方案 »
- DevExpress dateEdit 控件问题
- C# Socket问题,完全不解...分不多,请高手解惑...
- 关于.net开发交通导航系统
- 正则 如何将数字前面的0替换掉? 马上给分
- 同时装了vc6.0和.net,现在VC6.0的程序的所有文件默认也是用.net打开,如何解决?
- 如何用GPS结合visual2003(C#)获取本地的坐标?
- c#的字符串是如何进行大小比较的?
- 怎样才可以在主窗体Form_load的时候就把本身隐藏掉,用alt+Tab也不能切换出来?
- 正则概念问题
- 请问如何使用C#调用远程COM?
- 求大神指教,如何用。net对oracle数据库的emp表进行增删改查操作
- 想将一个变量值存在文件中是用ini方式好呢还是app.config方式好呢?
出错的是:
private void button2_Click(object sender, EventArgs e)
{
receiveCount = int.Parse(textBox2.Text);
toolStripProgressBar1.Maximum = receiveCount;
toolStripProgressBar1.Value = 0;
Thread threadReceive = new Thread(ReceiveMessage);
threadReceive.Start();
} private void ReceiveMessage()
{
statusStrip1.Invoke(shwStatusInfoCallBack, "接受中...");
for (int i = 0; i < receiveCount; i++)
{
try
{
string rcvMsgStr = br.ReadString();
//statusStrip1.Invoke(shwProgressProcCallBack, i + 1);
if (rcvMsgStr != null)
{
listBox1.Invoke(shwMsgforViewCallBack, rcvMsgStr);
}
}
catch(Exception e)
{
MessageBox.Show(e.ToString());
if (br != null)
{
br.Close();
}
if (bw != null)
{
bw.Close();
}
if (tcpClient != null)
{
tcpClient.Close();
}
//statusStrip1.Invoke(shwStatusInfoCallBack, "断开连接!");
//statusStrip1.Invoke(shwProgressProcCallBack, 0);
DateTime now = DateTime.Now;
while (now.AddSeconds(2) > DateTime.Now) { }
Thread threadAccept = new Thread(AcceptClientConnect);
threadAccept.Start();
break;
}
}
statusStrip1.Invoke(shwStatusInfoCallBack, "接受了" + receiveCount + "条信息. ");
}
出错的是:
private void button2_Click(object sender, EventArgs e)
{
receiveCount = int.Parse(textBox2.Text);
toolStripProgressBar1.Maximum = receiveCount;
toolStripProgressBar1.Value = 0;
Thread threadReceive = new Thread(ReceiveMessage);
threadReceive.Start();
} private void ReceiveMessage()
{
statusStrip1.Invoke(shwStatusInfoCallBack, "接受中...");
for (int i = 0; i < receiveCount; i++)
{
try
{
string rcvMsgStr = br.ReadString();
//statusStrip1.Invoke(shwProgressProcCallBack, i + 1);
if (rcvMsgStr != null)
{
listBox1.Invoke(shwMsgforViewCallBack, rcvMsgStr);
}
}
catch(Exception e)
{
MessageBox.Show(e.ToString());
if (br != null)
{
br.Close();
}
if (bw != null)
{
bw.Close();
}
if (tcpClient != null)
{
tcpClient.Close();
}
//statusStrip1.Invoke(shwStatusInfoCallBack, "断开连接!");
//statusStrip1.Invoke(shwProgressProcCallBack, 0);
DateTime now = DateTime.Now;
while (now.AddSeconds(2) > DateTime.Now) { }
Thread threadAccept = new Thread(AcceptClientConnect);
threadAccept.Start();
break;
}
}
statusStrip1.Invoke(shwStatusInfoCallBack, "接受了" + receiveCount + "条信息. ");
}