From: Catharinus on 22 Apr 2010 13:10 On 22 apr, 16:20, Catharinus <csvanderw...(a)planet.nl> wrote: > On 22 apr, 14:16, "Norm Cook" <normc...(a)cableone.net> wrote: > > > > > > > "Catharinus" <csvanderw...(a)planet.nl> wrote in message > > >news:ebebec86-0c8f-4eb2-bb44-1b1504052324(a)s9g2000yqa.googlegroups.com... > > On 21 apr, 23:24, "MikeD" <nob...(a)nowhere.edu> wrote:> "Catharinus" <csvanderw...(a)planet.nl> wrote in message > > > >news:2e882cfe-ec6c-4e0f-8791-76468bb15911(a)c21g2000yqk.googlegroups.com.... > > > <Clipped for brevity> > > Perhaps something like this (minimal testing): > > > 'class module named cMaskedEdit > > Option Explicit > > Public Event KeyPress(KeyAscii As Integer) > > Private WithEvents MB As MaskedBox > > 'Your properties, methods > > Public Sub SetMB(MaskedBox As MaskedBox) > > 'could also be a Property Set > > Set MB = MaskedBox > > End Sub > > Public Property Get Mask() As String > > Mask = MB.Mask > > End Property > > Public Property Let Mask(ByVal NewVal As String) > > MB.Mask = NewVal > > End Property > > 'etc > > 'MaskEdBox events > > Private Sub MB_Change() > > ' > > End Sub > > > Private Sub MB_KeyPress(KeyAscii As Integer) > > RaiseEvent KeyPress(KeyAscii) > > End Sub > > 'etc > > > ======================================== > > 'Form with a Masked Edit Box > > Option Explicit > > Private WithEvents oMask As cMaskedEdit > > Private Sub Form_Load() > > Set oMask = New cMaskedEdit > > oMask.SetMB MaskEdBox1 > > oMask.Mask = "###-###-####" > > Debug.Print oMask.Mask > > End Sub > > Private Sub oMask_KeyPress(KeyAscii As Integer) > > 'whatever > > End Sub > > thanks Norm > > I will try to build in this code in my MSHFlexgrid Class. That the > idea: use the maskedbox in a MSHFlexGrid. BTW. I want to us a property > set for th MaskEdbox. Could that be: > Public Property Set MBBox(Maskedbox as Maskedbox) > set MB=maskedbox > end sub > ?? > Thanks > Catharinus- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - But his code is immediately one visible problem: the clase should create the maskedbox by which the form doesn't have to contain a maskedbox. And the problem with that was the type mismach. set MB=fg.controls.add("MSMASK.MASKEDBOX","Maskedbox1",fg.container) where fg is the MSHFLExgrid.
From: MikeD on 22 Apr 2010 13:41 "Catharinus" <csvanderwerf(a)planet.nl> wrote in message news:5187a22a-8da9-4481-b4c3-eba7262a3d6f(a)q15g2000yqj.googlegroups.com... > But his code is immediately one visible problem: the clase should > create the maskedbox by which the form doesn't have to contain a > maskedbox. > And the problem with that was the type mismach. > > set MB=fg.controls.add("MSMASK.MASKEDBOX","Maskedbox1",fg.container) > where fg is the MSHFLExgrid. > No. I think you're missing the point, which is to not use dynamic control addition. Create your maskedbox at design-time and provide a reference to it to the class module. But I think I see the problem, or at least "a" problem. The Controls collection is that of a form or user control. If "fg" is your flexgrid, that code should be throwing a compile-time error. Copy and paste your actual code. -- Mike
From: Bob Butler on 22 Apr 2010 13:48 "Catharinus" <csvanderwerf(a)planet.nl> wrote in message news:2e882cfe-ec6c-4e0f-8791-76468bb15911(a)c21g2000yqk.googlegroups.com... <cut> > I want to use the maskedbox this way, because I use it in a class > that can be called from any form that I want to use. Which is easier > than alway add it at designtime I think you're finding that that assumption is incorrect. IMO you should either add the control to the form in each project using this and pass a reference to the control to your class *or* convert your class into a user control which has a masked edit box on it. Adding a UC to a project is no harder than adding a class to a project.
First
|
Prev
|
Pages: 1 2 3 Prev: String array access doubt Next: Trouble reading .ini files on Win7 x64 |