Public Properties for controls added at runtime ?

R

Rob

I am not sure if this can be implemented....

There exists a TabContol (added at design time) to a form..

Tabs for this TabContol get added at run time.

Usage of the following 2 properties works quite welll in order to reference
the control.

Public Property TabControlAvailable() As TabControl
Get
Return Me.TabControl1
End Get
Set(ByVal value As TabControl)
Me.TabControl1 = value
End Set
End Property


Public Property SelectedTabAvailabe() As TabPage
Get
Return Me.TabControl1.SelectedTab
End Get
Set(ByVal value As TabPage)
Me.TabControl1.SelectedTab = value
End Set
End Property

However, there is also a Flow Layout Panel that also gets added to the Tab
page (dynamically) at runtime...

How may I access its properties ? Is it even possible ?
 
R

rowe_newsgroups

I am not sure if this can be implemented....

There exists a TabContol (added at design time) to a form..

Tabs for this TabContol get added at run time.

Usage of the following 2 properties works quite welll in order to reference
the control.

Public Property TabControlAvailable() As TabControl
Get
Return Me.TabControl1
End Get
Set(ByVal value As TabControl)
Me.TabControl1 = value
End Set
End Property

Public Property SelectedTabAvailabe() As TabPage
Get
Return Me.TabControl1.SelectedTab
End Get
Set(ByVal value As TabPage)
Me.TabControl1.SelectedTab = value
End Set
End Property

However, there is also a Flow Layout Panel that also gets added to the Tab
page (dynamically) at runtime...

How may I access its properties ? Is it even possible ?

The easiest way would be to track the FlowLayoutPanel in a variable,
and then return that variable. The other thing (which might be easier)
is to loop through the tabpage's control's collection and return the
FlowLayoutPanel (by looking at each control's type and other
properties). Or, if you are using .Net 2.0 (VB 2005) and you assigned
a value to the FlowLayoutPanel's Name property, you can use the
FindControl method.

Thanks,

Seth Rowe
 
R

Rob

Seth,

The following code does return the correct name of the Flow Layout Panel
(which will always be unique)...

So now I would like to loop thru the FlowLayout Panel and obtain values of
some textbox fields that are held in the multiple User Defined Controls
within the Flow layout panel...

Is that possible ?

For Each ctlr As Control In
TimeCapture.Instance.SelectedTabAvailable.Controls
MsgBox(ctlr.Name)
Next

Also, I do not think FindControl is available.... This is not a web app...
(look like it resides in the System.Web.UI)

Thanks,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top