Link to home
Start Free TrialLog in
Avatar of dgb
dgb

asked on

Usercontrol with maskedit

I've made an usercontrol on the basis of maskedEditBox.
Is there a way to pass all the functionality of the maskedEdit from the "inside" maskedEditbox to the "outside" of the usercontrol
without having to program all the functions and properties
Avatar of Sancler
Sancler

I don't think so.  To allow that would render encapsulation meaningless.

What you might be able to do - although I do not know if this would meet your needs - is, rather than making a usercontrol based on the masked edit box, make your own class which inherits from the masked edit box.  Then all the functions and properties of the base class would also be exposed in the inherited class.

Roger
Avatar of Bob Learned
I agree with Roger.  Usually you wrap a different class to simplify the access methods, such as wrapping Windows API calls.  If you are going to encapsulate a MaskedEdit box, then you are looking to limit access to all the functionality.

Bob
Avatar of dgb

ASKER

Roger :
Can you explain it a bit more, maybe with a very small example


For now I've made an readonly property OrgObject wich passes the orginal maskedEditBox to the outside.
a bit of a workaround but it works.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Sancler
Sancler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Roger,

It sounds like we are assuming 2005 and the MaskedTextBox, and it might be 2003 with the COM MaskEditBox control.

Bob
Bob

True

Public Class MyMaskedEdit

    Inherits AxMSMask.AxMaskEdBox

    Public Sub setEuropeanDate()
        Me.Mask = "99 ??? 9999"
        Me.BackColor = Color.AliceBlue
        Me.Focus()
    End Sub

    Public Sub setUSDate()
        Me.Mask = "??? 99 9999"
        Me.BackColor = Color.Bisque
        Me.Focus()
    End Sub

    Public Sub clearMask()
        Me.Mask = ""
        Me.BackColor = Color.White
        Me.Focus()
    End Sub

End Class

Even more fatuous, but still illustrative ;-)

Roger
Avatar of dgb

ASKER

It's 2005 so the first example is oke.

Gone check it out, meanwhile i will reward the points.

Thanks.

Dirk