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
Which control is commonly used to create menus in a Windows Forms application in VB.NET? a) Button b) MenuStrip c) ListBox d) TextBox
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()
Which event is triggered when a menu item is clicked in VB.NET? a) MenuItemClick b) ItemClick c) Click d) MenuClick
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
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
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
In VB.NET, what method is used to close a custom dialog? a) Hide() b) Close() c) Exit() d) End()
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
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
Which control is used to create an MDI container in VB.NET? a) MDIParent b) MainForm c) FormContainer d) Panel
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
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
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
Which event is triggered when a new MDI child form is activated? a) FormActivate b) ChildActivate c) MDIActivate d) MDIChildChanged
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
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
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
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
Which control in VB.NET allows you to display a drop-down list in the toolbar? a) ComboBox b) DropDownButton c) ToolStripComboBox d) ToolStripDropDownButton
What method is used to refresh the MenuStrip control after making changes? a) RefreshMenu() b) Rebuild() c) UpdateMenu() d) PerformLayout()
Which method of the ToolStripButton is used to programmatically click the button? a) PerformClick() b) Click() c) TriggerClick() d) InvokeClick()
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
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
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
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
In VB.NET, which event is used to capture when a menu item is selected? a) MenuSelect b) ItemSelected c) Click d) MenuItemClicked
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:
Qno
Answer (Option with text)
1
b) MenuStrip
2
c) Items.Add()
3
c) Click
4
a) Use ToolStrip control
5
b) Alignment
6
b) By creating a new Form class
7
b) To display a custom form as a modal dialog
8
b) Close()
9
a) DialogResult
10
c) By using constructor parameters
11
a) Ability to manage multiple open forms within a single window
12
a) MDIParent
13
b) Set its MDIParent property to the parent form
14
c) MDIParent
15
b) Looping through MDIChildren and calling Close()