The following sample of code contains errors. Rewrite the incorrect statements t
ID: 3772345 • Letter: T
Question
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors. Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As Sys-tem.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing verify that the user wants to exit the application Dim dlgButton As DialogResult dlgButton = MessageBox.Show("Do you want to exit", "Sample Program") if the No button was selected, don't close the form If dlgButton = DialogResult.Yes Thene.Cancel = True End If End Sub Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load fill combo box with values, then select default value For intNumber As Integer From 0 Thru 10 cboNumbers. d(intNumber.ToString) Next intNumber cboNumbers.Selectedltem = First End SubExplanation / Answer
CODE :
Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'verify that the user wants to exit the application'
Dim dlgButton As DialogResult
dlgButton = MessageBox.Show("Dou you want to exit?", "Sample Program")
'if the No button was selected, don't close the form'
If dlgButton = DialogResult.Yes Then
e.Cancel = True
End If
End Sub
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'fill combo box with values, then select default value'
For intNumber As Integer = 0 To 10
cboNumbers.Items.Add(intNumber.ToString)
Next intNumber
cboNumbers.SelectedItem = cboNumbers.Text.First
End Sub