MCQs on Windows Forms Advanced Topics | Visual Basic .NET (VB.NET)

Explore 30 multiple-choice questions on advanced Windows Forms topics in Visual Basic .NET (VB.NET). Topics include Menus and Toolbars, Custom Dialogs, and MDI Applications. These questions are designed to test your knowledge and improve your understanding of these advanced VB.NET concepts.


MCQs:

Menus and Toolbars

  1. Which control is commonly used to create menus in a Windows Forms application in VB.NET?
    a) Button
    b) MenuStrip
    c) ListBox
    d) TextBox
  2. In VB.NET, what method is used to add a new item to the MenuStrip control?
    a) AddItem()
    b) AddMenuItem()
    c) Items.Add()
    d) Menu.Add()
  3. Which event is triggered when a menu item is clicked in VB.NET?
    a) MenuItemClick
    b) ItemClick
    c) Click
    d) MenuClick
  4. How can you create a toolbar in a Windows Forms application in VB.NET?
    a) Use ToolStrip control
    b) Use MenuStrip control
    c) Use PictureBox control
    d) Use Button control
  5. Which property of the MenuStrip control allows you to set the alignment of the menu items?
    a) TextAlign
    b) Alignment
    c) MenuAlignment
    d) Dock

Custom Dialogs and Forms
6. How do you create a custom dialog box in VB.NET?
a) By using the MessageBox class
b) By creating a new Form class
c) By using the DialogBox class
d) By modifying the Button control

  1. What is the purpose of the ShowDialog() method in VB.NET?
    a) To display a message box
    b) To display a custom form as a modal dialog
    c) To show a non-modal form
    d) To create a new thread
  2. In VB.NET, what method is used to close a custom dialog?
    a) Hide()
    b) Close()
    c) Exit()
    d) End()
  3. What property determines whether a custom dialog box in VB.NET appears as modal or non-modal?
    a) DialogResult
    b) IsModal
    c) ShowModal
    d) ShowInTaskbar
  4. How can you pass data between a main form and a custom dialog in VB.NET?
    a) By using public variables
    b) By using the DialogResult
    c) By using constructor parameters
    d) By setting properties of the custom dialog

MDI (Multiple Document Interface) Applications
11. What is the main advantage of using MDI in a Windows Forms application?
a) Ability to manage multiple open forms within a single window
b) To run multiple applications simultaneously
c) To open files in multiple threads
d) To allow background processing

  1. Which control is used to create an MDI container in VB.NET?
    a) MDIParent
    b) MainForm
    c) FormContainer
    d) Panel
  2. How do you designate a form as an MDI child in VB.NET?
    a) Set its IsMDIChild property to true
    b) Set its MDIParent property to the parent form
    c) Use the AddMDIChild() method
    d) Use the FormType property
  3. Which property of an MDI child form in VB.NET allows it to appear within the parent’s window?
    a) ParentForm
    b) MDIChild
    c) MDIParent
    d) ParentWindow
  4. How do you close all MDI child forms from the parent form in VB.NET?
    a) Using CloseAll() method
    b) Looping through MDIChildren and calling Close()
    c) Setting MDIParent property to null
    d) Calling Clear() on MDIChildren collection
  5. Which event is triggered when a new MDI child form is activated?
    a) FormActivate
    b) ChildActivate
    c) MDIActivate
    d) MDIChildChanged
  6. In VB.NET, how do you disable the maximization of MDI child forms?
    a) Set the MaximizeBox property to false
    b) Set the MDIChild property to false
    c) Use the DisableMaximize() method
    d) Set the FormBorderStyle to FixedDialog
  7. How can you add a toolbar to an MDI parent form in VB.NET?
    a) Use the ToolStrip control
    b) Use the MenuStrip control
    c) Add a Button control
    d) Use the Toolbar control
  8. Which method allows an MDI parent to resize all its child forms simultaneously in VB.NET?
    a) AdjustSize()
    b) ResizeAll()
    c) ResizeChildForms()
    d) None of the above
  9. Which property can you use to hide the title bar of an MDI child form in VB.NET?
    a) HideTitleBar
    b) TitleBarVisible
    c) ShowInTaskbar
    d) ControlBox

Miscellaneous
21. How can you add a separator between menu items in a MenuStrip control?
a) Use the Separator property
b) Insert a hyphen in the item name
c) Use the ToolStripSeparator control
d) Use the Divide property

  1. Which control in VB.NET allows you to display a drop-down list in the toolbar?
    a) ComboBox
    b) DropDownButton
    c) ToolStripComboBox
    d) ToolStripDropDownButton
  2. What method is used to refresh the MenuStrip control after making changes?
    a) RefreshMenu()
    b) Rebuild()
    c) UpdateMenu()
    d) PerformLayout()
  3. Which method of the ToolStripButton is used to programmatically click the button?
    a) PerformClick()
    b) Click()
    c) TriggerClick()
    d) InvokeClick()
  4. Which class is used to create a custom dialog box that can accept multiple inputs in VB.NET?
    a) InputBox
    b) MessageBox
    c) Form
    d) CustomDialog
  5. How can you restrict the size of an MDI child form in VB.NET?
    a) Set the MaximumSize property
    b) Set the SizeMode property
    c) Use a form resize event
    d) Set the MDIChild property to true
  6. How do you make an MDI child form always stay on top of other windows?
    a) Set TopMost to true
    b) Use StayOnTop() method
    c) Set ZOrder property
    d) None of the above
  7. How can you display a custom dialog without blocking the main thread in VB.NET?
    a) Show() method
    b) ShowDialog() method
    c) OpenForm() method
    d) DisplayModal() method
  8. In VB.NET, which event is used to capture when a menu item is selected?
    a) MenuSelect
    b) ItemSelected
    c) Click
    d) MenuItemClicked
  9. How can you dynamically add items to a MenuStrip in VB.NET?
    a) MenuStrip.Items.Add()
    b) AddMenuItem()
    c) MenuStrip.Add()
    d) Items.Insert()

Answers:

QnoAnswer (Option with text)
1b) MenuStrip
2c) Items.Add()
3c) Click
4a) Use ToolStrip control
5b) Alignment
6b) By creating a new Form class
7b) To display a custom form as a modal dialog
8b) Close()
9a) DialogResult
10c) By using constructor parameters
11a) Ability to manage multiple open forms within a single window
12a) MDIParent
13b) Set its MDIParent property to the parent form
14c) MDIParent
15b) Looping through MDIChildren and calling Close()
16c) MDIActivate
17a) Set the MaximizeBox property to false
18a) Use the ToolStrip control
19d) None of the above
20d) ControlBox
21c) Use the ToolStripSeparator control
22c) ToolStripComboBox
23d) PerformLayout()
24a) PerformClick()
25d) CustomDialog
26a) Set the MaximumSize property
27a) Set TopMost to true
28a) Show()
29c) Click
30a) MenuStrip.Items.Add()

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top