Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inheritance in vb.net
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
Inheritance in vb.net
Environment versions
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Miscellaneous
Thread ID:
01485789
Message ID:
01485789
Views:
114
I have subclassed textboxes, panels and buttons. For each of those controls, I wrote an IOEnable method. I would like my (subclassed) form to execute these methods. I came up with something like this, which works, but am wondering if there is not a more generic approach to this, because now, each time I subclass a control I have to kind of "register" it here and in every container.
For Each ctrl As Control In Me.Controls
     If TypeOf ctrl Is txtBase Then
         Dim ctrl1 As txtBase = ctrl
         ctrl1.ioEnable(value)
     End If
     If TypeOf ctrl Is pnlBase Then
         Dim ctrl1 As pnlBase = ctrl
         ctrl1.ioEnable(value)
     End If
     If TypeOf ctrl Is btnBase Then
         Dim ctrl1 As btnBase = ctrl
         ctrl1.ioEnable(value)
     End If
 Next
In VFP this looked like this
for each o in this.Controls
        if !pemstatus(o,'IOEnable',5)
            loop
        endif
        o.IOEnable()
    endif
endfor

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Next
Reply
Map
View

Click here to load this message in the networking platform