Click here to Skip to main content
15,918,967 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to get the characters individually from a text entered in the EditBox in MFC.

For Example, I populated the editbox variable with "Hello World". Now I want to get the Character by character i.e First 'H', then 'E', then 'L', then 'L', then 'O' like that?
Posted

1 solution

I don't believe there is a method of CEdit that will do this explicitly, but you could write a method yourself.
 char  CEdit::GetCharByIndex(int nIndex)
{
  CString  wndText;
  GetWindowText(wndText);

  ASSERT ( nIndex < wndText.GetLength() );

  return ( wndText.GetAt(nIndex) );
}
That's all off the top of my head. YMMV. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900