Displaying the file without scrolling - document class, Visual Basic Programming

Displaying the file Without Scrolling:

To display a file follow the steps as shown below:

1. Generate a SDI application.

2. Type the coding as shown in the Serialize else part. The CArchive objects are used for writing or for retrieving the file.

3. Generate a global string m_pdata in the document class. To generate the global data click on the ClassView tabpage.

Enlarge the tree control of classes.

Select the CStoreDoc class.

Right click and choose the add member variable.

Specify the type as char and the variable name as *m_pdata

The GetFile() function of the CArchive is used for selecting the file to be displayed.

The GetLength() returns the size of the file.

4. Allocate the memory to the string m_pdata by using the new operator.

5. The Read function of CArchive stores the ncount characters of the file to be displayed in the string of m_pdata.

6. The string m_pdata is displayed by using AfxMessageBox.

7. The dynamically allocated memory is improved by using the delete function.

8. Construct and execute the project.

9. Choose a file and open the menu item.

10. Choose a file.

11. The contents will be displayed in the message box.

void CStoreDoc::Serialize(CArchive& ar)

{

if (ar.IsStoring())

{

}

else

{

unsigned int ncount = ar.GetFile()->GetLength();

m_pdata= new char[ncount];

ar.Read(m_pdata,ncount);

AfxMessageBox(m_pdata);

delete [] m_pdata;

}

}

Posted Date: 10/10/2012 2:03:01 AM | Location : United States







Related Discussions:- Displaying the file without scrolling - document class, Assignment Help, Ask Question on Displaying the file without scrolling - document class, Get Answer, Expert's Help, Displaying the file without scrolling - document class Discussions

Write discussion on Displaying the file without scrolling - document class
Your posts are moderated
Related Questions
need help with logic part of loan program

CONTROL ARRAY The control array is a group of similar objects with similar name. Adding controls with control arrays uses less resource than simply adding the multiple controls

A variable is convenient placeholder which refers to a computer memory location where you can store program information which may change when your script is running. For instance,

Please help me.. I am loading data from a text file to a class (Item Inventory from Tony Gaddis - Visual Basic - Chapter 12 -programming challange# 7-9) and the last item loaded is

For this assignment you have to design and implement a VB.NET project which prepares a bill of payment due, given the purchase amount. The project models a typical purchase transac

To run only one statement while a condition is True, employ the single-line syntax for the If...Then...Else statement. The following instance shows the single-line syntax. Notice t

Retrieval Methods: There are 3 ways to find a document. The primary method is a positional retrieval. This is achieved by keeping in mind where you left it. The next method is

Create a VB calculator application that appears as in the screen shots below. The user enters numbers in the textboxes labelled Number 1 and Number 2. When a calculati

Using Visual Studio 2010 C++ 1) Using Windows Explorer, make a copy of Irvine\examples\Project_sample folder in the folder where you keep your materials for this course.

I have a tiff image of 25 pages. I capture particular square from particular page and past on one excel sheet one by one. it is possible, if yes how. Image have line no and pe