Markusl
April 29th, 1999, 06:43 PM
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?
Bob Clarke
April 29th, 1999, 08:54 PM
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();
}
Markusl
April 30th, 1999, 01:48 AM
Actully I use VC 4, but I hope it won't make much of a difference.