F11和F5执行的结果不一样?

xspjob 2006-07-10 11:30:07
F11和F5执行的结果不一样?我写一个方法,直接F5,出来的结果和F11出来的结果不一样,方法是返回一字符串。F5返回的字符串只有一小部份,而F11返回是全部》
...全文
155 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xspjob 2006-07-10
  • 打赏
  • 举报
回复
VS2005
Knight94 2006-07-10
  • 打赏
  • 举报
回复
串口数据读取?

如果是的话,就是你的时间延迟问题。

你是在什么环境下,vs2003 or vs2005?
xspjob 2006-07-10
  • 打赏
  • 举报
回复
public string ExeATCommand ( string p_ATCommand )
{
string result = string.Empty; // 返回结果内容
int SendCommandCount = 0; // 重试次数
if (p_ATCommand != string.Empty && s_port.IsOpen == true)
{

s_port.Write(p_ATCommand); // 输出命令到串口
System.Threading.Thread.Sleep(retryTimeOut); // 延迟指定时间
while (SendCommandCount <= retryCount)
{
// 没有达到重试次数时,始终执行
System.Threading.Thread.Sleep(retryTimeOut); // 延迟指定时间
result += s_port.ReadExisting(); // 读取结果
if (result.Length > 0 && result.Length > p_ATCommand.Length)
{
result = result.Replace(p_ATCommand + "\r\r\n", string.Empty); // 去掉发送过来的命令,关心结果
break;
}
SendCommandCount++;

}
}

return result;
}
Knight94 2006-07-10
  • 打赏
  • 举报
回复
贴出你的代码看看
Knight94 2006-07-10
  • 打赏
  • 举报
回复
看看按F5后,是否重新编译了
xspjob 2006-07-10
  • 打赏
  • 举报
回复
没用过,贴点代码了?
Knight94 2006-07-10
  • 打赏
  • 举报
回复
如果你用的是2005带的com话,数据来的有事件触发。在相应的事件中做处理要合理些。
xspjob 2006-07-10
  • 打赏
  • 举报
回复
那应该设为多少呢,我现在设置为100S;

110,502

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧