I defined a CStatic variable,
and I am trying to use the variable with
DoDataExchange. But, I always get a runtime
error ( I want to change the text of the static control).
CStatic m_strCtrl;
DDX_Control(pdx,IDC_STATIC1,m_stcCtrl);
...
m_strCtrl.SetWindowText("Test");
TIA,
-jc
Also, you need to do this call in OnInitDialog() after the call to
UpdateData() or the base constructor has been called.
Tom
"jc" <j...@discussions.microsoft.com> wrote in message
news:56A0CA14-FC40-4DE7...@microsoft.com...
Thank you for taking the time to reply to my posting.
Yes, that worked!
-jc
At no point have you explained what you have done. You have not shown where the CStatic
is declared (is it in the class?), you have not shown the control ID associated with
IDC_STATIC1 (which is a LOUSY name for a control!), you have not shown any context where
the error occurs, you have not shown where the SetWindowText takes place, and overall this
is not a coherent question. You missed showing EVERYTHING that might actually help us
answer the question!
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Providing, of course, that all necessary preconditions are met.
joe
On Fri, 19 Jun 2009 14:15:49 -0700, Henryk Birecki <soarin...@sbcglobal.net> wrote:
>You assigned a Control object not a string variable to resource. The
>latter would be
>
>CString m_s;
>
>DDX_Text((pdx,IDC_STATIC1,m_s);
>
>You can still use CStatic and set/get text using
> m_stcCtrl.SetWindowText(text);
> m_stcCtrl.GetWindowText(text);
>
>Henryk Birecki