Print Page | Close Window

[SOLVED] Finding each control with same ID

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=17081
Printed Date: 06 October 2024 at 8:32am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] Finding each control with same ID
Posted By: sforces
Subject: [SOLVED] Finding each control with same ID
Date Posted: 07 August 2010 at 3:27pm
I am using RibbonBar and directly on it I have a checkbox control to "Enable XYZ" and ID_OPTION_ENABLE_XYZ.

I also have a "Options" popup control and a button control there is also "Enable XYZ" and ID_OPTION_ENABLE_XYZ.

I thought that if I use same ID (as they are really same) that when I use "FindControl" method, it would toggle the Checked property for both of them. But it only finds one and the other isn't toggled.

1) Is it a bad idea to have same ID?
2) I thought about using a for each loop on the commandbars objects, checking the ID and checked state but I don't think that's very efficient. How do I efficiently find all controls with same ID and toggle them?

-------------
Product: Xtreme Suite Pro (ActiveX) version 16.3.1

Platform: Windows XP SP3 (32bit)

Language: Visual Basic 6.0 SP6



Replies:
Posted By: jpbro
Date Posted: 07 August 2010 at 4:07pm
I think you should be using Actions in this case - check out the Actions sample that comes with the suite.

With actions, you can associate multiple controls with a single action, and then enable/disable an action and all of the associated controls will be enabled/disabled accordingly.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: sforces
Date Posted: 09 August 2010 at 9:58am
Thank you. This is exactly what I was looking for!

Originally posted by jpbro jpbro wrote:

I think you should be using Actions in this case - check out the Actions sample that comes with the suite.With actions, you can associate multiple controls with a single action, and then enable/disable an action and all of the associated controls will be enabled/disabled accordingly.


-------------
Product: Xtreme Suite Pro (ActiveX) version 16.3.1

Platform: Windows XP SP3 (32bit)

Language: Visual Basic 6.0 SP6


Posted By: jpbro
Date Posted: 09 August 2010 at 11:36am
Glad to help!

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net