473,378 Members | 1,389 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,378 software developers and data experts.

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
CompositeControl and I implement it as follows:

Protected Overrides Sub CreateChildControls()
For Each section As FormSection In Me.Sections
MyBase.Controls.Add(section)
Next
MyBase.CreateChildControls()
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(ByVal source As Object,
ByVal e As EventArgs) As Boolean

If TypeOf e Is CommandEventArgs 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 CommandEventArgs
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 880

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

Similar topics

4
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...
9
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...
1
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...
9
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...
4
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...
0
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
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: ...
4
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.