View Single Post
 
Old 05-31-2022, 04:15 AM
JamesMWood JamesMWood is offline Windows 10 Office 2021
Novice
 
Join Date: May 2022
Posts: 25
JamesMWood is on a distinguished road
Question Why is control not defined?

Hi there

I'm working on a simple macro where a button clears all checkboxes. Any reason why Visual Studio is saying "Type 'Control' is not defined" and "Typed 'CheckBox' is not defined" ?

Private Sub ClearSelection_Click(sender As Object, e As EventArgs) Handles ClearSelection.Click
For Each ctrl As Control In Me.Controls
If TypeOf ctrl Is CheckBox Then
DirectCast(ctrl, CheckBox).CheckState = CheckState.Unchecked
End If
Next
End Sub

Thanks a lot
James
Reply With Quote