请教大家个验证编辑框的内容是否为空的问题

tangyao13711927 2008-09-11 11:10:48
我试图验证用户是否在编辑框中输入了内容,程序如下:
UpdateData(TRUE);
int i = m_ComBox.GetCurSel();
m_ComBox.GetLBText(i, m_strguestSex);

m_guestID.GetWindowTextW(m_strguestID);
m_guestName.GetWindowTextW(m_strguestName);
m_orderID.GetWindowTextW(m_strorderID);
m_roomID.GetWindowTextW(m_strroomID);
m_guestNation.GetWindowTextW(m_strguestNation);
m_guestPost.GetWindowTextW(m_strguestPost);
m_guestTel.GetWindowTextW(m_strguestTel);

if((m_strguestID.IsEmpty()) || (m_strguestName.IsEmpty()) || (m_strorderID.IsEmpty()) || (m_strroomID.IsEmpty()) || (m_strguestNation.IsEmpty()) || (m_strguestPost.IsEmpty()) || (m_strguestSex.IsEmpty()) || (m_strguestTel.IsEmpty()))
{
AfxMessageBox(_T("输入的数据不完整,请重新输入!"));
return;
}

编译通过了,可是在执行的时候一旦编辑框中真的没输入内容的话,就会弹出错误说atlsimpstr.h文件的Line 876 Expression:nLength>=0
请问大家这是什么意思啊?怎么解决这个问题呢?谢谢大家啦
...全文
70 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xsc2001 2008-09-11
  • 打赏
  • 举报
回复
你用GetWindowTextW取得的是Unicode编码。
dbger 2008-09-11
  • 打赏
  • 举报
回复
为啥用GetWindowTextW?
m_strguestNation是CStringW不?
程序是UNICODE版本不?

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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