|
-
April 29th, 1999, 06:43 PM
#1
How to make an Editbox display a string
I want an Editbox to display a string. And as soon as I change the string, I want the editbox to update it. The second part with the update isn't necessary.
Can anyone help me with this please?
-
April 29th, 1999, 08:54 PM
#2
Re: How to make an Editbox display a string
Since you don't mention your programming environment, I'll assume it is VC5 or VC6.
CWnd::SetWindowText() can be used to set the contents of the edit box.
For the updating, use the Class Wizard's Message Map to map the EN_CHANGE notification message. Whenever the contents of the edit box changes, this method will be called. Inside this method, put code to update your string variable.
Example:
// in your initialization code
CString cSample("This is edit box text");
m_editBox.SetWindowText( cSample );
CSample::OnChangeEdit1()
{
cSample = m_editBox.GetWindowText();
}
-
April 30th, 1999, 01:48 AM
#3
Re: How to make an Editbox display a string
Actully I use VC 4, but I hope it won't make much of a difference.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|