473,973 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Property missing value

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 25 '08 #1
4 1217
The OnBubbleEvent method is called prior to the CreateChildCont rols method
in the Control lifecycle.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <md*****@gmail. comwrote in message
news:c6******** *************** ***********@n77 g2000hse.google groups.com...
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 25 '08 #2
On Feb 25, 11:41 am, "Kevin Spencer" <unclechutney@l ocalhostwrote:
The OnBubbleEvent method is called prior to the CreateChildCont rols method
in the Control lifecycle.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <mdmo...@gmail. comwrote in message

news:c6******** *************** ***********@n77 g2000hse.google groups.com...
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
So there is no solution to this?
How is this usually done? Any idea?

Basically, I need to stop the event if the Section controls do not
validate ...

Thanks,
Miguel
Feb 25 '08 #3
in OnBubbleEvent, before accessing any child controls, call
EnsureChildCont rols().

-- bruce (sqlwork.com)
"shapper" wrote:
On Feb 25, 11:41 am, "Kevin Spencer" <unclechutney@l ocalhostwrote:
The OnBubbleEvent method is called prior to the CreateChildCont rols method
in the Control lifecycle.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <mdmo...@gmail. comwrote in message

news:c6******** *************** ***********@n77 g2000hse.google groups.com...
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

So there is no solution to this?
How is this usually done? Any idea?

Basically, I need to stop the event if the Section controls do not
validate ...

Thanks,
Miguel
Feb 25 '08 #4
On Feb 25, 4:44 pm, bruce barker
<brucebar...@di scussions.micro soft.comwrote:
in OnBubbleEvent, before accessing any child controls, call
EnsureChildCont rols().

-- bruce (sqlwork.com)

"shapper" wrote:
On Feb 25, 11:41 am, "Kevin Spencer" <unclechutney@l ocalhostwrote:
The OnBubbleEvent method is called prior to the CreateChildCont rols method
in the Control lifecycle.
--
HTH,
Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
"shapper" <mdmo...@gmail. comwrote in message
>news:c6******* *************** ************@n7 7g2000hse.googl egroups.com...
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
So there is no solution to this?
How is this usually done? Any idea?
Basically, I need to stop the event if the Section controls do not
validate ...
Thanks,
Miguel
I tried but it does not work.

Any idea?

Thanks,
Miguel
Feb 27 '08 #5

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

Similar topics

6
2977
by: dmiller23462 | last post by:
Here is the code, it's not complete of course....I've been inserting lines as I go to pinpoint the issue.....I understand that the error message I'm getting (#185 Missing Default Property) is referring to "textfile" but I can't find any information as to what the default property SHOULD be.... By the way, I'm working on an online submission form for our intranet that emails several parties AND THEN appends to a text file for later...
5
2194
by: Mike | last post by:
My first simple attempt at using a property. and I get an exception "An unhandled exception of type 'System.StackOverflowException' occurred in BalanceOmatic.exe" on line xxx. I have included the property code and the button event used to set and call the property value. Any help greatly appreciated. What am I missing?
7
2304
by: vh | last post by:
Hi, I'm new to C#. Most examples about properties I found are sth like the following: class A{ private int property; public int Property { get { return property; } set { property = value; } } }
0
5580
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control is used to view the state of the running jobs and schedule new jobs. The control also runs in the context of Internet Explorer (we do this so the administrators of the jobs can always receive the latest control). The property grid is used to...
27
1890
by: Just Me | last post by:
I made a Usercontrol that must have AutoScroll set to true when it is used. So I set it to True in the Load event. However the property still shows in the properties window when the control is placed on a form. That's confusing. How can I make that property not show in the properties window?
5
6478
by: JimM | last post by:
how do you set property using Activator.CreateInstance? Dim ty As Type = Type.GetTypeFromProgID("Project1.Class1") Dim o As Object = System.Activator.CreateInstance(ty) Dim pi As PropertyInfo = ty.GetProperty("Test") Dim params() As Object = {1S}
37
2632
by: Joergen Bech | last post by:
(Slightly religious question): Suppose I have the following class: ---snip--- Public Class MyClass Private _MyVariable As Integer Public Property MyVariable() As Integer Get
8
2029
by: Al | last post by:
I'd like to create Class Library in VB 2005, which has a property accessible by external programs. I decided to include 1 Class with 1 property in this project. I placed this code in Class: Public Class COM Private mMyProp As String Public Property MyProp() As String
9
5062
by: Eric | last post by:
Hi Everyone, I'm writing a UserControl that exposes a property of the type System.Drawing.Image, like this: Public Property DefaultImage() As Image Get Return propDefaultImage End Get Set(ByVal Value As Image)
11
3993
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject is instance of MyEntity class. There is no MyProperty property in MyObject at design time.
0
10901
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10071
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
8453
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
7600
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
6410
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
6542
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5147
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
4726
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3755
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.