473,413 Members | 2,066 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,413 software developers and data experts.

question about checkboxes

I have about ten checkboxes in a group box and there are about five
different types of group boxes on a form.

Why will this not work?

//
For Each c As CheckBox In gbAGD1.Controls
If c.Checked = True Then agFlag = True
Next
\\

I get a cast error.

What I want to do is instead of writing a line for each checkbox, just
iterate through the collection and see if one is checked.

Thanks for the information.

Brad
Nov 21 '05 #1
1 819
"Brad" <ba******@ukcdogs.com> schrieb:
I have about ten checkboxes in a group box and there are about five
different types of group boxes on a form.

Why will this not work?

//
For Each c As CheckBox In gbAGD1.Controls
If c.Checked = True Then agFlag = True
Next
\\

I get a cast error.


\\\
For Each c As Control In Foo.Controls
If TypeOf c Is CheckBox Then
If DirectCast(c, CheckBox).Checked Then
Flag = True
End If
End If
Next c
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the...
5
by: middletree | last post by:
I know this isn't the right forum, but this is driving me crazy, and I don't think I'm very off, probably one little thing is keeping me from being successful. I'd like to have two radio...
7
by: Gui Lloyd | last post by:
I have a problem with performance in IE. The script above works quite fine when the table has a small number of elements, but, when the table has 2500 elements, when I click in the checkbox of the...
0
by: Patrick Olurotimi Ige | last post by:
I have a Datalist and i want CheckBoxes in it. The Datalist is popluated from the Database. I want to be able to select the checkboxes with the populated Datalist and insert to table. But i want...
5
by: astro | last post by:
I want to have 2 mutually exclusive checkboxes on a webform. I do not want to post back to server for this to happen. Last week I built this using javascript with each ctrl calling a javascript...
2
by: momo | last post by:
Guys, I am trying to created a detailview that displays several records at a time. Let's say I have a GridView with checkboxes and when I check two checkboxes and click a button, I want it to...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
5
by: rn5a | last post by:
In my application, I want to populate all the directories & files existing in a directory on the server in a DataGrid. To ensure that all the directories get listed first followed by all the files,...
0
by: Wudi008 | last post by:
Hi, I am using C#, I have a treeView in my windows.form , I want to give checkboxes for some nodes in the treeView but not all of them. If i do treeView.checkbox = true, all the nodes would have...
6
by: JonathanS | last post by:
Hi -- I'm working on some VBA in Excel 2000 to automate some spreadsheet tasks. I have a really basic question about checkboxes... I've been using a "toy" program to try to figure out how to get the...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.