Solved

MFC C++ edit box issue

Posted on 2009-05-11
3
823 Views
Last Modified: 2013-12-14
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
0
Comment
Question by:kingofnines
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 250 total points
ID: 24355967
Hi kingofnines,

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

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

Hope that helps,

ZOPPO
0
 
LVL 5

Author Comment

by:kingofnines
ID: 24356053
Well, dont I feel silly. Thank you Zoppo!

Alan
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 24359029
:o)

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

Have a nice day,

best regards,

ZOPPO
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question