473,414 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Clear all checkboxes at form load

Hi,

I have a pile of checkboxes on one particular form and would like to clear them all at the form load rather that saying chk1.Checked = False for all of them.

Here is the code I was trying to use but 'checked' is not a member of Systems.Windows.Forms.Controls.
Expand|Select|Wrap|Line Numbers
  1.     Dim ctl As Control
  2.         For Each ctl In Me.Controls
  3.             If TypeOf ctl Is CheckBox Then
  4.                 ctl.checked = False
  5.             End If
  6.         Next ctl
  7.  
How can I fix this??
Thanks.
Feb 4 '09 #1
2 9227
Plater
7,872 Expert 4TB
Well how did they get checked in the first place?
When a form loads it reads the values from what you set in the designer.
So at design time make sure they are all false?


Otherwise your sample code is almost right, you would just need to check inside container controls (GroupBox for example) and check their child controls to see if they are checkboxes.
As for your error, your are not casting the control as a CheckBox before trying to use the Checked proeprty
Feb 4 '09 #2
Thanks.
Sorted now
Feb 5 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Chris Thunell | last post by:
Right now I have a vb.net windows form project that does a whole bunch of things on the form.load event. The problem with this is that the user does not see the form until all the those things are...
0
by: Hohn Upshew | last post by:
My problem is that after chosing an order from the list and open a report, the form stays with the number of the customer for that number and cannot be requeried.How can i clear the form? This is ...
0
by: Doslil | last post by:
I have a form which is designed to only data entery.When i try to open to form in the run form I have the following errors 1. when i open the form I get an error message saying "Access can't...
3
by: Dennis | last post by:
I have the following code for showing a form: dim frm as new myForm frm.ShowDialog (The Form Load Event is fired then I hide the form using Me.Hide when the X in the UR corner is clicked). ...
6
by: tony | last post by:
Hello! When exactly is it important or advisable to use this form load event handler compare to using the C-tor. For example here I create an event handler called dataBoundGridForm that is...
1
mafaisal
by: mafaisal | last post by:
hello Experts I am Using VB.Net2005 See My Code Private Sub Format_Grid() DstMax.Clear() StrSQL = "Select a.SlNo,a.CardID,b.Name,a.MaxLimit From CompanyLimits a,Card...
3
by: jamesnkk | last post by:
Hi, I am new to vb6. I have some code written in the form load. the first time when I call the form, the code inside form load will activate. After I have complete the form and return to main...
6
Megalog
by: Megalog | last post by:
Hey guys, my turn to ask a question =D Ok here's my situation.. I have a super simple form, which is bound to a table with a single record. All the controls (mostly text boxes, some true/false...
4
by: rb0135 | last post by:
Hi, I am writing a C# mobile 6 (dot.net 3.5) application. On the form, I have a label. I update this label with text as my initalizing routines are running (from the form load event), such as...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.