Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent \r\n in CEditView

Status
Not open for further replies.

kogg

Programmer
Jun 7, 2003
17
0
0
GB
Hello

I have a CEditView in a splitterWindow when I hit the return key the data in the windows is captured in the OnChar(...) message handler using GetWindowText(..).

My problem is when I clear the window using SetWindowText("") it leaves a \r\n which is not what I intended. Its making my head bleed, does anyone know how to rid this \r\n.

Thanks

kogg
 
You can GetWindowText into a CSTring Variable, myVar and use CString's function Trim() to remove the extra variables or use the Replace() to replace them with white space

Code:
[blue]
CString myVar;
myEdit.GetWindowText(myVar);
myVar.Trim("\r\n");  [green]// OR myVar.Replace("\r\n","");[/green]
myEdit.SetWindowText(myVar); [/blue]

Hope that helps!
-Ron

/**************
Me: When will the project be finished?
Them: What project?
Me: The one you have been working on for the last 3 years!
Them: Ohh, we can't finish it?
Me: Why?
Them: We don't know how to program...
 
That is a nice solution that works - thanks very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top