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

Assignment Help:

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;

}

}


Related Discussions:- Displaying the file without scrolling - document class

Program to draw a rectangle shape , Create a project that draw a rectangle ...

Create a project that draw a rectangle shape which may be either (*) or (+) according to the selected radio button. The number of rows in the shape will be taken from the 1 st

Balancesheet, i need sample balance sheet form in vb.net

i need sample balance sheet form in vb.net

Genetics, GENETICS 1.         The branch genetics started in 1900 after...

GENETICS 1.         The branch genetics started in 1900 after rediscovery of Mendel's work. 2.         Gregor Johann Mendel is called Father of genetics. 3.         The t

Imagelist, IMAGELIST The CImageList object is a collection of the same ...

IMAGELIST The CImageList object is a collection of the same sized images, all of which can be referred to by its index. The ImageList are used to proficiently manage the large

Vb program for simple image processing, A program needs to be written that ...

A program needs to be written that is capable of simple image processing. All the images that are available for you to use, can be found on Blackboard in the Assignments section. T

Collection is adding last record, Please help me.. I am loading data from ...

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

Kitchen mock, How to pull ordered menu from a cash till to database or disp...

How to pull ordered menu from a cash till to database or display on a computer screen

Arrays, I need to design a logic for a program that allows a user to enter ...

I need to design a logic for a program that allows a user to enter 15 numbers, then displays each number and its difference from the numeric average of the numbers entered

Executesql - database application, Executesql: The ExecuteSQL is used ...

Executesql: The ExecuteSQL is used for executing the query on the database. The CRecordset uses the RFX mechanism to replace data between field data members of the record set

Coding, Write an event procedure to automate the billing system of a superm...

Write an event procedure to automate the billing system of a supermarket. Give the details of database tables, forms, controls and menu design (if any). Make assumptions, wherever

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd