How to create a method on base class that known members from subclass?


How to create a method on base class that known members from subclass?...
Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I Created a BaseForm Class (inherited from Strataframe form) and create a sublass of it (countriesForm)



How I can create a method on BaseForm that known members of the inherited form?



Suppose I create a method named "ChangeTextBoxBackColor" and I want to call it under some circunstanse on my countriesform to change all the textbox dropped on it.



When I debug the method "ChangeTextBoxBackColor" on the base, I not see the textboxes from the countriesForm.



thanks!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You have to recursively call the Controls collection to dig down and get them.  The Controls collection on a form (or any control object) is not flat and so you have to recursively enumerate the Controls collections to get to all of the objects.  More than likely you put your textboxes in a group box, so the Form.Controls will only see the group box and not the text box.  The text boxes will be in the GroupBox.Controls collection.

Private Sub SearchControls(Byval controlItems As Control.ControlCollection)
    For each item as Control in controlItems
        '-- Cycle through the child objects
        If item.Count > 0 Then
            SearchControls(item.Controls)
        End If
    Next
End SUb

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I suppose and do it,

the only way is that I pass parameters, not another way that base see sublass / implementation



Thanks for all replies and supress all my doubts.



StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yeah, any time the base class needs to see something from the subclass, you need to either pass the data through parameters or have a property/method that is overriden (even defined as MustOverride) that the base class can call to pull from the subclass.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search