Multiple choice technology programming languages

You use Visual Studio .NET to create a Windows-based application. The application includes a form named TestKingProcedures (TKP). TKP allows users to enter very lengthy text into a database. When users click the Print button located on TKP, this text must be printed by the default printer. You implement the printing functionality by using the native .NET System Class Libraries with all default settings. Users report that only the first page of the text is being printed. How should you correct this problem?

  1. In the BeginPrint event, set the HasMorePages property of the PrintEventArgs object to True.

  2. In the EndPrint event, set the HasMorePages property of the PrintEventArgs object to True.

  3. In the PrintPage event, set the HasMorePages property of the PrintPageEventArgs object to True.

  4. In the QueryPageSettings event, set the HasMorePages property of the QueryPageSettingEventArgs object to True.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The PrintPage event is where each page's content is printed, and setting HasMorePages to True tells the printing system there are more pages to print. BeginPrint fires once at the start, EndPrint once at the end - neither controls page continuation. QueryPageSettings is for page setup, not pagination. By checking if there's remaining content in PrintPage and setting HasMorePages accordingly, you enable multi-page printing. This is the standard pattern for multi-page print documents.

AI explanation

The .NET printing model prints one page per call to the PrintPage event, and it keeps calling that event repeatedly only while PrintPageEventArgs.HasMorePages is set to True. By default this flag is False, so unless the code explicitly sets it to True inside PrintPage when there is more content left to print, printing stops after the first page.