⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_41961.htm

📁 vc
💻 HTM
字号:
<p>
序号:41961 发表者:wangwt 发表日期:2003-05-30 16:37:47
<br>主题:急:关于对话框数据的获得问题!!!!高手们能快点给我答复吗?谢了~
<br>内容:如下代码:<BR>&nbsp;&nbsp;&nbsp;&nbsp;CMyDlg dlg;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(dlg.DoModal()==IDOK)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::AfxMessageBox(dlg.m_edit);////这句能通过<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CString str;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dlg.m_list.GetText(0,str);////对m_list控件的任何操作都会出错<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ////怎么解决<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::AfxMessageBox(str);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>m_edit为CMyDlg中的一个EDIT控件对应的变量,m_list为CMyDlg中的一个list控件对应的变量.<BR>能确定m_edit和m_list中一定有数据。<BR>请问为什么会在操作列表控件的时候出错呢?????(实际上不仅是列表控件,combox控件,Tree控件都不行)
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:holywang 回复日期:2003-05-30 16:48:08
<br>内容:在对话矿的DoModal()调用之后,控件已经不存在了,所以调用出错。<BR>可以针对想获得数据的控件增加相应的变量,调用就可以了。<BR>如:<BR>&nbsp;&nbsp;&nbsp;&nbsp;CMyDlg dlg;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(dlg.DoModal()==IDOK)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CString str;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str= dlg.m_text;//m_text 为控件针对的变量。<BR>}<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -