473,835 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is this property empty when I added child controls and can seethem?

Hello,

I have a control with the following property:

Private _Sections As New List(Of FormSection)
Public Property Sections() As List(Of FormSection)
Get
If _Sections Is Nothing Then
_Sections = New List(Of FormSection)
End If
Return _Sections
End Get
Set(ByVal value As List(Of FormSection))
_Sections = value
End Set
End Property

FormSection is another custom control. My control inherits from
CompositeContro l and I implement it as follows:

Protected Overrides Sub CreateChildCont rols()
For Each section As FormSection In Me.Sections
MyBase.Controls .Add(section)
Next
MyBase.CreateCh ildControls()
End Sub

Finally I need to run a method from a child control in each section
when a Bubble event is caught:

Protected Overrides Function OnBubbleEvent(B yVal source As Object,
ByVal e As EventArgs) As Boolean

If TypeOf e Is CommandEventArg s Then

For Each section In Me.Sections
For Each field In section.Fields
If Not field.Validate Then

' Stop bubbling for EventArgs
Return True

End If
Next field
Next section
OnCommand(e)

End If

' Let bubbling run for non CommandEventArg s
Return False

End Function

The problem is that Me.Sections has no section in it so the loop does
not run.

But the sections are there! I added them and when I run the page I see
all them.

What am I doing wrong?

Thanks,

Miguel
Feb 23 '08 #1
0 892

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

Similar topics

4
1651
by: Peter Hamilton | last post by:
I am trying to implement inheritance but I am having a difficult time with some concepts. What I am trying to do is have a Child object inherit from the Parent, and when you set a property value at the Parent level, I want all of the children to see this change. Likewise, when I set a Parent's property value in the child object, both the parent and all of the children see the change. Maybe what I am trying to do is not "inheritance" after...
9
3678
by: Rakesh | last post by:
Hi, I am able to obtain a MenuItem object's Name property @ design-time, but am not able to get the same @ run- time...why? And since MenuItem doesn't inherit from Control class, it's not even supposed to be available @ design-time right?
1
1063
by: shapper | last post by:
Hello, I am creating a custom control and I have the following property: <Bindable(True), Category("Appearance"), DefaultValue(""), Localizable(True)Property Text() As String Get Dim s As String = CStr(ViewState("Text")) If s Is Nothing Then Return String.Empty Else
9
9718
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
4
2701
by: Mark Olbert | last post by:
I've written a composite custom control which I would like to have update its design-time display when one of several properties changes at design time. These custom properties are not simply the exposed properties of the constituent controls (e.g., they control how many constitutent controls are displayed). I am at a loss as to how to go about doing this. I have a custom designer for the control, but I don't see any functionality in the...
0
1216
by: shapper | last post by:
Hello, I want to create an ordered list where each list item can have various controls: <ol> <li>textbox, label, ...</li> ... </ol>
2
935
by: shapper | last post by:
Hello, I am creating a custom control, named Form, which inherits from CompositeControl. I am adding child custom controls, named Section, to the Form through the following property: Private _Sections As New List(Of FormSection) Public Property Sections() As List(Of FormSection)
4
1211
by: shapper | last post by:
Hello, I have a control with the following property: Private _Sections As New List(Of FormSection) Public Property Sections() As List(Of FormSection) Get If _Sections Is Nothing Then _Sections = New List(Of FormSection) End If
1
3483
by: bytesFTW99 | last post by:
I have been struggling with this for some time can anyone help out? just trying to have 3 dropdown boxes that fill depending on what is selected, then in some cases click a button and have the second set of 3 dropdown boxes be filled with the same values. thank you <head> <SCRIPT LANGUAGE="JavaScript" type="text/javascript"> var firstChoice2 = 0; var secondChoice2 = 0;
0
9810
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
9653
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
10815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10563
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
9348
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...
0
6970
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5640
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
5808
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3094
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.