MCQs on Introduction to Forms and Controls | Visual Basic .NET (VB.NET)

Master Windows Forms applications with these 30 handpicked MCQs. Dive into controls like TextBox, Label, Button, and event handling. Perfect for students and developers aiming to sharpen their VB.NET skills.


MCQs: Introduction to Forms and Controls

Creating Your First Windows Forms Application

  1. Which namespace is primarily used for creating Windows Forms in VB.NET?
    a) System.Windows.Forms
    b) System.Windows.UI
    c) System.Forms.App
    d) System.Application.Forms
  2. What is the default file extension for a Windows Forms project in VB.NET?
    a) .vbproj
    b) .csproj
    c) .wfproj
    d) .vbform
  3. What is the entry point method for a Windows Forms application?
    a) Main()
    b) Start()
    c) Run()
    d) Init()
  4. Which class is used to represent a Windows Form?
    a) Window
    b) Form
    c) Application
    d) Control
  5. What is the primary method used to display a Windows Form?
    a) Show()
    b) Display()
    c) Render()
    d) Present()

Common Controls: TextBox, Label, Button

  1. Which control is used to display text that cannot be edited by the user?
    a) TextBox
    b) Label
    c) Button
    d) ListBox
  2. How do you set the initial text in a TextBox?
    a) TextBox.Text = “value”
    b) TextBox.SetText(“value”)
    c) TextBox.Value = “value”
    d) TextBox.TextField = “value”
  3. Which event is triggered when a user clicks a Button?
    a) ButtonPressed
    b) Click
    c) ActionPerformed
    d) OnClick
  4. What property of a Label control determines its displayed text?
    a) TextValue
    b) LabelText
    c) Text
    d) Content
  5. What is the default behavior of the Tab key in a TextBox?
    a) Moves to the next TextBox
    b) Inserts a tab character
    c) Does nothing
    d) Triggers an event

Handling Events (Click, TextChanged)

  1. Which method is used to handle the Click event of a Button?
    a) AddHandler
    b) AssignEvent
    c) SetHandler
    d) HandleEvent
  2. What is the default signature of a Click event handler?
    a) Private Sub Button_Click()
    b) Public Sub ButtonClick(ByVal sender As Object)
    c) Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
    d) Private Function ButtonClick(ByVal sender As Object, ByVal e As EventArgs)
  3. The TextChanged event is fired when:
    a) A Button is clicked
    b) The text of a control changes
    c) A form is resized
    d) A control is focused
  4. How do you attach an event handler to a control in code?
    a) Control.Event = AddressOf HandlerMethod
    b) AddHandler Control.Event, AddressOf HandlerMethod
    c) SetHandler(Control.Event, HandlerMethod)
    d) AttachEvent(Control.Event, HandlerMethod)
  5. What is the main purpose of the TextChanged event in a TextBox?
    a) Monitor text input dynamically
    b) Detect form submission
    c) Validate form data
    d) Trigger on focus change

Advanced Topics on Controls

  1. Which property determines if a control is visible to the user?
    a) Enabled
    b) Visible
    c) Displayed
    d) Shown
  2. How can you disable user interaction with a Button?
    a) Set Enabled to False
    b) Set Active to False
    c) Set Usable to False
    d) Set Available to False
  3. What property of a TextBox sets a password character mask?
    a) TextMask
    b) MaskChar
    c) PasswordChar
    d) HiddenChar
  4. What does the Anchor property of a control define?
    a) The control’s docking position
    b) The control’s resizing behavior
    c) The control’s alignment
    d) The control’s visibility
  5. Which property of a Label enables multiline text display?
    a) Multiline
    b) WrapText
    c) AutoSize
    d) WordWrap

General Questions on Forms and Controls

  1. What is the function of the Dock property in a control?
    a) Adjust size based on parent container
    b) Align control to the form edges
    c) Fix position on the form
    d) Handle focus priority
  2. What event is triggered when a form is closed?
    a) Closing
    b) FormClosed
    c) End
    d) Dispose
  3. Which property sets the title of a form?
    a) Title
    b) Caption
    c) Text
    d) Header
  4. How can you programmatically close a Windows Form?
    a) Form.Close()
    b) Form.End()
    c) Form.Terminate()
    d) Form.Dispose()
  5. What property is used to control the transparency of a form?
    a) TransparentValue
    b) Opacity
    c) AlphaLevel
    d) Transparency
  6. How do you make a TextBox read-only?
    a) Set ReadOnly to True
    b) Set Editable to False
    c) Set Lock to True
    d) Set Writable to False
  7. Which event is triggered when a form is loaded?
    a) Initialize
    b) Load
    c) FormLoad
    d) Activated
  8. How do you add a tooltip to a control?
    a) Use the Tooltip property
    b) Attach a ToolTip component
    c) AddHandler Tooltip.Text
    d) Set Hint property
  9. What does the AutoSize property do for a Label?
    a) Automatically adjusts the size to fit the text
    b) Resizes based on parent container
    c) Locks the current size
    d) Dynamically changes font size
  10. Which control would you use for accepting multiline text input?
    a) TextBox with Multiline enabled
    b) Label with WrapText enabled
    c) RichTextBox
    d) Both a and c

Answers Table

QnoAnswer (Option with Text)
1a) System.Windows.Forms
2a) .vbproj
3a) Main()
4b) Form
5a) Show()
6b) Label
7a) TextBox.Text = “value”
8b) Click
9c) Text
10a) Moves to the next TextBox
11b) AddHandler
12c) Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
13b) The text of a control changes
14b) AddHandler Control.Event, AddressOf HandlerMethod
15a) Monitor text input dynamically
16b) Visible
17a) Set Enabled to False
18c) PasswordChar
19b) The control’s resizing behavior
20d) WordWrap
21b) Align control to the form edges
22b) FormClosed
23c) Text
24a) Form.Close()
25b) Opacity
26a) Set ReadOnly to True
27b) Load
28b) Attach a ToolTip component
29a) Automatically adjusts the size to fit the text
30d) Both a and c

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