B
Brian P. Hammer
Hi all,
I have a button where when clicked, I want it to remove some controls from my form.
Private Sub cmdHide1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdHide1.Click
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.tag = "Aircraft1" Then
Me.Controls.Remove(ctrl)
End If
Next ctrl
End Sub
This produces an error of:
An unhandled exception of type 'System.NullReferenceException' occurred in Financial Model.exe
Additional information: Object reference not set to an instance of an object.
In a test form, if I only have a couple of text boxes and one button, it throws the exception too. What am I missing?
Thanks,
Brian Hammer
I have a button where when clicked, I want it to remove some controls from my form.
Private Sub cmdHide1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdHide1.Click
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.tag = "Aircraft1" Then
Me.Controls.Remove(ctrl)
End If
Next ctrl
End Sub
This produces an error of:
An unhandled exception of type 'System.NullReferenceException' occurred in Financial Model.exe
Additional information: Object reference not set to an instance of an object.
In a test form, if I only have a couple of text boxes and one button, it throws the exception too. What am I missing?
Thanks,
Brian Hammer