Solved

MFC C++ edit box issue

Posted on 2009-05-11
3
832 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

 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

624 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