473,804 Members | 3,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Questions about User Controls

I've built a user control inherited button and I need it to change the
enabled property of all the controls on the form except for the labels and
buttons. I'd like to use this control on other forms to do the same.

I've tried the following:

Dim a as ControlsCollect ion = Me.Parent.Contr ols
Dim s as Controls

For Each s in a
s.enabled = False
Next

This sets all the controls enabled property to false including labels and
buttons. Any suggestions on how I can only change the enabled property of
certain controls?
--
TC
Sep 17 '05 #1
3 1244
Hi Terrance,

What do you mean by certain controls?
You can certainly check for certain control types and disable only those

[C#]
foreach(Control c in a)
{
if(a is Button || a is TextBox)
c.Enabled = false;
}
On Sat, 17 Sep 2005 05:15:01 +0200, Terrance <Te******@discu ssions.microsof t.com> wrote:
I've built a user control inherited button and I need it to change the
enabled property of all the controls on the form except for the labels and
buttons. I'd like to use this control on other forms to do the same.

I've tried the following:

Dim a as ControlsCollect ion = Me.Parent.Contr ols
Dim s as Controls

For Each s in a
s.enabled = False
Next

This sets all the controls enabled property to false including labels and
buttons. Any suggestions on how I can only change the enabled property of
certain controls?


--
Happy coding!
Morten Wennevik [C# MVP]
Sep 17 '05 #2
By certain controls I mean controls such as labels adn buttons.
--
TC
"Morten Wennevik" wrote:
Hi Terrance,

What do you mean by certain controls?
You can certainly check for certain control types and disable only those

[C#]
foreach(Control c in a)
{
if(a is Button || a is TextBox)
c.Enabled = false;
}
On Sat, 17 Sep 2005 05:15:01 +0200, Terrance <Te******@discu ssions.microsof t.com> wrote:
I've built a user control inherited button and I need it to change the
enabled property of all the controls on the form except for the labels and
buttons. I'd like to use this control on other forms to do the same.

I've tried the following:

Dim a as ControlsCollect ion = Me.Parent.Contr ols
Dim s as Controls

For Each s in a
s.enabled = False
Next

This sets all the controls enabled property to false including labels and
buttons. Any suggestions on how I can only change the enabled property of
certain controls?


--
Happy coding!
Morten Wennevik [C# MVP]

Sep 17 '05 #3
Well, if you need to disable only certain labels and certain buttons and not all labels and buttons, then you need some way of marking which controls should be disabled(for instance using the Tag or Name properties), or keep a separate list of those controls.

On Sat, 17 Sep 2005 16:44:04 +0200, Terrance <Te******@discu ssions.microsof t.com> wrote:
By certain controls I mean controls such as labels adn buttons.


--
Happy coding!
Morten Wennevik [C# MVP]
Sep 17 '05 #4

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

Similar topics

0
2077
by: Henry | last post by:
Using ideas provided by some of you I was able to figure out how to get the names of the parameters fields of a crystal report specified at run time. The code below just basically puts the data into a comboBox. One thing I noticed, however, is that this method shows me both the parameters used by the main report and parameters used by the sub-report(s).
2
1370
by: Wee Bubba | last post by:
i started by designing my web page using frames. i had my data entry form in an upper form and my data rows displaying in a lower frame. i soon discovered that ASP.NET is not really meant for frames so I changed this to a single page with both the entry form and the display rows on it which posts back to itself(an improvement i hope?) ok my single page also needs to have the ability to search for stuff as you enter data. I know I can...
23
27114
by: Rick | last post by:
Hi, I'm currently preparing for an interview on VB.Net Development.. could someone please give me an idea as to what type of questions can one ask (it's a practical test) and what sort of things I should be prepared for? It's going to be on VB.Net and connectivity with SQL Server perhaps.. any help would be appreciated. Thank you Rick
3
326
by: Terrance | last post by:
I've built a user control inherited button and I need it to change the enabled property of all the controls on the form except for the labels and buttons. I'd like to use this control on other forms to do the same. I've tried the following: Dim a as ControlsCollection = Me.Parent.Controls Dim s as Controls For Each s in a
14
4976
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
0
1744
by: Michael.Suarez | last post by:
So we develop and maintain several applications used by several people in the same company, on the same intranet. There are several applications written in VB6, but going forward all of the new development will be done in .NET 2.0, including eventual rewrites of all the VB6 apps. The VB6 executables are all stored in a network folder, and everyone accesses these exe's using shortcuts to them on their desktop. Going forward, we will...
13
12818
by: M.Siler | last post by:
Let me clarify from my last post. I am not using these 4 questions as the sole screening method. Currently in, the Tampa Bay area (Florida) there is an extreme shortage of C# developers. We have utilized just about every method known to man to find candidates, including employment firms (which I do not like to use, but when you're back in against the proverbial wall). With the employment firms they will send over just about anyone. So after...
3
1332
by: Chris S | last post by:
We are moving from ASP.Net 1.1 to ASP.Net 2.0. As we do not have the luxury of spending weeks trying out different techniques, I'd like to rely on some tried and true methods, but need some feedback so we don't stray too far from best practices. ASP.Net User Controls (ascx files) Our team is very comfortable with the use of ASP.Net User Controls which do
4
6068
by: shamirza | last post by:
4 9 6 18.ATLAS-AJAX Note: - As an IT professional it's useful to know what the difference is between Hype and usefulness. For instance if there is a new technology coming in many programmers just want to implement it because they want to learn it?. But any new technology becomes useful if it is useful to the user. And Ajax is one of the technologies which will be useful as it really
0
9588
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10327
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.