Link to home
Start Free TrialLog in
Avatar of fredmastro
fredmastroFlag for United States of America

asked on

Need to show whole text file in a edit box.

I have code below which loads a text file into an edit box on a dialog window.  Only it only show the first 100 or so characters.  I have scroll boxes etx, but how can I get it to show the whole text file in any length.  That way I can scroll down the text file in the edit box in the dialog window.  Am I using the wrong kind of variable.  It's set as a value and then CString.  I use ClassWizrad.

Please speak in laymens terms, I'm a newbie and will get lost easy if you use crazy words.

Here's my code.

void CNumbersDlg::OnLoadNumbers()
{
      // TODO: Add your control notification handler code
        // here

      //Will Load the Numbers.TXT File

      CFile f;
      if ( f.Open("E:\\Numbers.txt", CFile::modeRead)== FALSE )
            return;

      //Creare an archive odject
      CArchive ar( &f, CArchive::load );

      //Serialzie data from the archive into m_NumbersEdit
      ar >> m_NumbersEdit;

      //Close the archive
      ar.Close();

      //Close the file.
      f.Close();

      //Update screen with the Numbers information
      UpdateData(FALSE);
}
Avatar of thresher_shark
thresher_shark

Have you set the dialog box to be multi-lined?  And is the variable m_NumbersEdit a CString?
Avatar of fredmastro

ASKER

The Dialog box is multi-lined and the the variable is CSting. (I mentioned that in the original question).
ASKER CERTIFIED SOLUTION
Avatar of slicer
slicer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Second method is tested one....
Too complicated for a newbie like me.
Too complicated for me.  I did other researhing and found that you can't add all those characters to an edit box unless I change it's buffer somehow.  I have to use a richedit box.