M
Michael Maes
Hello,
I have a BaseForm with (eg) one Timer in the Components'collection & one Button in the Controls'Collection
Also there are three Subs: Load, ScanControls & ScanComponents.
The BaseForm is only used to be inherited from (and inherits from System.Windows.Forms.Form).
Private Sub BaseForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
ScanControls()
ScanComponents()
End Sub
Private Sub ScanControls()
Dim [Control] As System.Windows.Forms.Control
For Each [Control] In Me.Controls
' Scan recursive through the ControlCollection
' Put in HashTableControls
' Do some stuff
Next
End Sub
Private Sub ScanComponents()
Dim [Component] As System.ComponentModel.Component
For Each [Component] In Me.components.Components
' Put in HashTableComponents
' Do some stuff
Next
End Sub
I have Another Form (eg: DisplayForm) which inherits from the BaseForm.
It adds (eg) a Label & a ImageList.
a.. If I look at the ControlsCollection (HashTableControls) I "find" a Button & a Label (Which is correct)
b.. If I look at the ComponentsCollection (HashTableComponents) I only "find" a Timer (Which is wrong: it should also contain the ImageList)
What is wrong with this approach?
TIA,
Michael
I have a BaseForm with (eg) one Timer in the Components'collection & one Button in the Controls'Collection
Also there are three Subs: Load, ScanControls & ScanComponents.
The BaseForm is only used to be inherited from (and inherits from System.Windows.Forms.Form).
Private Sub BaseForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
ScanControls()
ScanComponents()
End Sub
Private Sub ScanControls()
Dim [Control] As System.Windows.Forms.Control
For Each [Control] In Me.Controls
' Scan recursive through the ControlCollection
' Put in HashTableControls
' Do some stuff
Next
End Sub
Private Sub ScanComponents()
Dim [Component] As System.ComponentModel.Component
For Each [Component] In Me.components.Components
' Put in HashTableComponents
' Do some stuff
Next
End Sub
I have Another Form (eg: DisplayForm) which inherits from the BaseForm.
It adds (eg) a Label & a ImageList.
a.. If I look at the ControlsCollection (HashTableControls) I "find" a Button & a Label (Which is correct)
b.. If I look at the ComponentsCollection (HashTableComponents) I only "find" a Timer (Which is wrong: it should also contain the ImageList)
What is wrong with this approach?
TIA,
Michael