MFC C++ edit box issue

I have an EditBox I use to collect data that is then moved to ListBox. I declared the variable for the edit box as type CString. This is how I move the text...

strText = m_txtListbox;
m_ctlListBox.AddString(strText);

 My problem is that I can't seem to clear the editbox after the text is moved to the ListBox. I tried this...

m_txtListbox.Delete(0,m_txtListbox.GetLength());

and this...

m_txtListbox.Empty();

Neither one removes the text from the text box. SO, how do I remove the text from the EditBox?


Thank you,

Alan
LVL 5
kingofninesAsked:
Who is Participating?
 
ZoppoConnect With a Mentor Commented:
Hi kingofnines,

to do so you'll have to use UpdateData, i.e.:

> UpdateData( TRUE );
> ...
> m_txtListbox = "";
> UpdateData( FALSE );

Hope that helps,

ZOPPO
0
 
kingofninesAuthor Commented:
Well, dont I feel silly. Thank you Zoppo!

Alan
0
 
ZoppoCommented:
:o)

No problem, you're welcome - I'm glad I could help ...

Have a nice day,

best regards,

ZOPPO
0
All Courses

From novice to tech pro — start learning today.