只要一运行程序到这里,程序就自动关闭了,不知是出了什么问题
clientsocket1.Socket.SendText(recinfo); //将发送出去的信息显示到界面表格中
titem:=listview1.Items.Add;
titem.Caption:='';
if clientsocket1.Active=true then //从这里开始有问题
begin
titem.ImageIndex:=0;
end else
begin
titem.ImageIndex:=1;
end;
titem.SubItems.Add(recinfo);
titem.SubItems.Add(timetostr(time()));
titem.SubItems.Add(datetostr(date()));
我是想在这里作一个判断,如果没有发送出去,就在listview1的第一行打个‘X’。如果发送出去就打个勾,结果程序一运行到这一段就自动关闭了
如果只是
if clientsocket1.Active=true then //从这里开始有问题
begin
titem.ImageIndex:=0;
end;不要else没有问题不关闭程序,一加上else就关闭程序,即便是把titem.ImageIndex:=0;换成showmessage('0')也一样,程序自动关闭,不过的我的TCP/IP是没有连接的,不知是不是这个原因,急啊
clientsocket1.Socket.SendText(recinfo); //将发送出去的信息显示到界面表格中
titem:=listview1.Items.Add;
titem.Caption:='';
if clientsocket1.Active=true then //从这里开始有问题
begin
titem.ImageIndex:=0;
end else
begin
titem.ImageIndex:=1;
end;
titem.SubItems.Add(recinfo);
titem.SubItems.Add(timetostr(time()));
titem.SubItems.Add(datetostr(date()));
我是想在这里作一个判断,如果没有发送出去,就在listview1的第一行打个‘X’。如果发送出去就打个勾,结果程序一运行到这一段就自动关闭了
如果只是
if clientsocket1.Active=true then //从这里开始有问题
begin
titem.ImageIndex:=0;
end;不要else没有问题不关闭程序,一加上else就关闭程序,即便是把titem.ImageIndex:=0;换成showmessage('0')也一样,程序自动关闭,不过的我的TCP/IP是没有连接的,不知是不是这个原因,急啊
解决方案 »
- 有项目需找人合作完成
- 有关MDI窗口的创建问题!
- 求助!开始进行查询时显示一个Panel告知“查询中。。。”查询完毕Panel自动消失!
- 关于sendmessage的用法
- 關于DBGRID列的問題
- 问: keypress 与keydown 事件有什么区别呢?
- delphi 2009中使用DBX时,双击SQLConnection控件怎么不好用啊?哪位大侠熟悉DBX??
- 多谢了,各位老兄,用QRshape可以画出表格,但对角线怎么画呢?另外,我用panel也试了一下,它好象不能画线,具体能介绍一下它的用法吧!!
- 不知道为什么,我在用Length函数出现两个不同的
- 用delphi6,第一个多线程测试程序便崩溃~请大家来测试
- 关于后缀为zwp文件的问题
- 求MS SQL Server 2000 数据分页及數據操作控制的解決方案!
if clientsocket1.Active=true then // 始终为false 将执行else中的代码
begin
titem.ImageIndex:=0; //检测此句
end
else
begin
titem.ImageIndex:=1; //检测此句
end;
似乎不合情理
clientsocket1.Socket.SendText(recinfo); if not clientsocket1.Active=true then exit;
titem:=listview1.Items.Add;
titem.Caption:='';
titem.ImageIndex:=0;
titem.SubItems.Add(recinfo);
titem.SubItems.Add(timetostr(time()));
titem.SubItems.Add(datetostr(date()));
...
打错了,应该是
if not clientsocket1.Active then exit;