Contents

Which method is used to close a form in Visual Basic?
a) Close()                             
b) Exit()
c) Dispose()                          
d) End ()

a

Explanation: The "Close()" method is used in Visual Basic to close a form, allowing the user to exit or terminate the form's display and return to the previous state.


Which control is used to play audio and video files in Visual Basic?
a) MediaControl 
b) MediaPlayer
c) AudioVideoControl                       
d) AxWindowsMediaPlayer

d

Explanation:
The "AxWindowsMediaPlayer" control is used in Visual Basic to play audio and video files, providing a user-friendly media player for multimedia playback within the application.


How do you add a new item to a ListBox control in Visual Basic at runtime?
a) listBox.Items.Add("New Item")
b) listBox.NewItem("New Item")
c) listBox.AddItem("New Item")     
d) listBox.InsertItem("New Item")

a

Explanation: To add a new item to a ListBox control at runtime in Visual Basic, you can use the "Items.Add" method followed by the value of the new item enclosed in double quotes.


Which event is triggered when the user presses a key while a control has focus in a Visual Basic form?
a) Key_Press                      
b) Key_Down
c) Key_Up                            
d) Key_Event

a

Explanation: The "Key_Press" event is triggered when the user presses a key while a control has focus in a Visual Basic form, allowing developers to respond to key presses and handle user input.


What is the purpose of the "DoEvents" method in Visual Basic?
a) To create a loop structure            
b) To pause execution and allow other events to be processed
c) To display a message box to the user
d) To handle errors and exceptions

b

Explanation: The "DoEvents" method in Visual Basic is used to temporarily pause the execution of the code within a loop or a long-running operation, allowing other events to be processed and maintaining responsiveness in the user interface.


Which property is used to set the title of a Visual Basic form?
a) Title                                  
b) Caption
c) Text                                  
d) Header

c

Explanation: The "Text" property is used to set the title or caption of a Visual Basic form, which appears in the title bar of the form window.