#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
Fixed, just needed to add:
Imports System.Windows.Forms to the top of the code |
Tags |
checkbox |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
FileSystemObject Compile Error: User-Defined Type Not Defined | gsrikanth | Excel Programming | 2 | 03-28-2022 06:32 AM |
Application Defined or Object defined error | bennyamy | Excel Programming | 4 | 03-23-2017 11:42 AM |
User-defined Type not Defined VBA Issue | OTPM | Project | 3 | 01-02-2014 01:47 PM |
Range.Information(wdStartOfRangeRowNumber): Application-defined or Object-defined err | tinfanide | Excel Programming | 2 | 06-09-2012 10:19 AM |
Application-defined or Object-defined error | Manit | Excel Programming | 4 | 12-08-2011 07:35 PM |