Create a UI for a Windows Forms Application by Using Standard Controls

These questions are based on 70-526VB: TS: Microsoft .NET Framework 2.0 – Windows-Based Client Development (VB.NET)
Microsoft
Self Test Software Practice Test


Objective: Create a UI for a Windows Forms application by using standard controls.
Sub-objective: Add and configure a Windows Forms control.


Single answer, multiple-choice


You are an application developer in a company. You create Windows-based applications using Visual Basic .NET. You need to create a user interface to be used by the planning and organization department of your company. On a Windows form, you need to display the calendars of three consecutive months starting from the current month. The calendars should be placed in a vertical direction one under the other in sequence. You have placed a MonthCalendar on the Windows form named MonthCalendar1.


Which code you should add in the Windows form of the application to display three such calendars?



  1. Me.MonthCalendar1.CalendarDimensions = New System.Drawing.Size(1, 3)
  2. Me.MonthCalendar1.CalendarDimensions = New System.Drawing.Size(3, 1)
  3. Me.MonthCalendar1.CalendarDimensions = New System.Drawing.Size(0, 3)
  4. Me.MonthCalendar1.CalendarDimensions = New System.Drawing.Size(3, 0)

Answer:
A. Me.MonthCalendar1.CalendarDimensions = New System.Drawing.Size(1, 3)


Tutorial:
You should add the following code:


Me.MonthCalendar1.CalendarDimensions = New System.Drawing.Size(1, 3)


This code uses the CalendarDimensions property of the MonthCalendar control. This property specifies a Size representing the number of columns and rows of months to be displayed for the MonthCalendar control on the Windows form. You can display the maximum of 12 months together at the same time, and all the monthly calendars to be displayed should belong to the same year. When specifying the Size value, the first integer represents the number of columns to use when displaying the calendars, and the second integer represents the number of rows to use when displaying the calendars. With this code, there will be one column of three consecutive monthly calendars displayed on the form in a vertical direction.


You should not use the code that specifies a Size of (3, 1). Using this code there will be three columns and one row, and the calendars will display horizontally instead of vertically.


You should not use the code that specifies a Size of (0, 3) because the value 0 for the columns is not a valid value. This code will generate a run-time error in the application.


You should not use the code that specifies a Size of (3, 0) because the value 0 for the rows is not a valid value. This code will generate a run-time error in the application.


References:
MSDN Library > Development Tools and Languages > Visual Studio > Visual Studio Tools for Office > Reference > Microsoft.Office.Tools.Excel.Controls > MonthCalendar Class > MonthCalendar Properties


MSDN Library > .NET Development > .NET Framework SDK > Class Library Reference > System.Windows.Forms > MonthCalendar Class > MonthCalendar Properties > CalendarDimensions Property

Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone
cmadmin

ABOUT THE AUTHOR

Posted in Archive|

Comment:

Leave a comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>