473,729 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a control to ControlCollecti on.

I am having trouble adding a control to ControlCollecti on in a class I have derived from GroupBox. Here is what I've got

__gc class RowColumn : public System::Windows ::Forms::GroupB o

public
RowColumn()
ignoredcontrols = new System::Windows ::Forms::Contro l::ControlColle ction(this)
void IgnoreControl(S ystem::Windows: :Forms::Control * control)
ignoredcontrols->Add(control)
void DoSomething()
int i
for(i=0; i < ignoredcontrols->Count; i++)
/*...*

private

System::Windows ::Forms::Contro l::ControlColle ction* ignoredcontrols
}

When I call RowColumn::Igno reControl() the control isn't added to my collection. I checked in the debugger and ignoredcontrols->Count is 0 and ignoredcontrols->ReadOnly is false. There is no exception through, it just doesn't add the control. Any ideas why this doesn't work?
Nov 17 '05 #1
1 1862
http://msdn.microsoft.com/library/en...ssaddtopic.asp

Looking at the notes in the ControlCollecti on.Add function it says a control can only be part of one control collection at a time. I guess I'll have to do something like an array of cotrols or something.
Nov 17 '05 #2

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

Similar topics

2
4523
by: Keith Patrick | last post by:
How does one declare a method to be "hidebysig"? I am trying to make some type-specific collections, mirroring System.Window.Forms.Control.ControlCollection, but I cannot figure out how to get past the requirements of IList. For instance, if I implement IList, I must have: public void Add(Object item) but I can't figure out how to hide it with public void Add(Subclass Item)
5
8165
by: Codemonkey | last post by:
Hi, When I first installed Visual Studio 2003, I noticed I was getting the follow error when showing a form: A first chance exception of type 'System.ArithmeticException' occurred in system.drawing.dll Additional information: Overflow or underflow in the arithmetic operation It is being thrown on the line that attempts to add the controls to the
7
6255
by: Mark Denardo | last post by:
Hi I have a TabControl object that I need to insert new TabPages into. To append them to the end of the Controls Collection I can do: tc.controls.add(tp) (tc - tabcontrol object) (tp - tabpage object) But how can I insert them into the middle of collection? I see a 'RemoveAt' method that takes an index to remove at a specific location, how come
2
1104
by: Just Me | last post by:
What does it mean to add a control to a ListBox?? It inherits it from Control.ControlCollection Class . I can understand adding a control to a Panel but not to a ListBox. Thanks in advance
2
4922
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
6
1526
by: crazyjh | last post by:
hello i want to add some controls in according of the time. but when the time change, i call the method again to add controls again,No effect! i think maybe i should unload the controls adding before,how can i unload it?? pls help me,thanks
11
18138
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with ListView columns so it should be doable, thanks
8
2058
by: Suikwan | last post by:
Im trying to add the textboxes in a form to a control collection which I will test later. For some reason my control collection ends up empty. None of the controls are added. Any help would be greatly appreciated. Code follows. Dim contcoll As ControlCollection Dim cont As Control contcoll = New ControlCollection(Me) For Each cont In Me.Controls If TypeOf cont Is TextBox Then contcoll.Add(cont)
2
2647
by: =?Utf-8?B?VHJldm9y?= | last post by:
Hi, I'm trying to write a general function to simply clear a collection of fields from both a group box and a tab control. Here is what I want my code to look like: private void ClearFields(GroupBox groupbox) { ClearFields((ControlCollection)groupbox.Controls); }
0
8925
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8763
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
9288
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
9206
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
8156
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
6722
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
4531
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
4797
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.