local cConstrolSource, nAt, cAlias, a[1], n *-- MG(eds) 10/07/98 - 11:18 - Now only default alligned numerics are left justified. if !this.lMaskit return endif cControlSource= alltrim(this.ControlSource) *-- No controlSource, No Mask if empty(cControlSource) return endif *-- ControlSources are explicit nAt= at('.',cControlSource) if nAT= 0 cAlias= alias() else cAlias= left(cControlSource,nAT-1) if upper(cAlias)= "THISFORM" return endif if upper(cAlias)= "THIS" return endif *-- can't be if !used(cAlias) wait this.Name+' has a controlSource on a closed table' window return endif endif *-- find the Control Source's info form the database (ask oDb?) select (cAlias) cField= substr(cControlSource,nAt+1) set fields to (cField) n= afields(a,cAlias) set fields to set fields off *-- can't be if n= 0 error this.Name+' xMask failure' endif *-- if empty(this.InputMask) do case case a[2]= 'N' *-- MG(eds) 10/07/98 - 11:20 if this.alignment= 3 this.alignment= 0 && left justify endif if a[4]=0 this.InputMask= repl('9',a[3]) this.format= 'IKZ' else this.InputMask= repl('9',a[3]-a[4])+'.'+repl('9',a[4]) this.format= 'IKZ' endif case a[2]= 'C' this.InputMask= repl('!',a[3]) this.format= 'KZ' case a[2]= "D" this.Inputmask= "99/99/99" this.format= "KD" endcase endifIn vb.net at this stage I have to pass a Datacolumncollection. The problem with this is that I must call the maskit routine at the form level (that parses through the controls) from the load event of the instance, rather than from the form base because the bound table is named by the generator.
Me.MasKit(Me.FeestdagenDataset.Feestdagen.Columns)
Friend Sub MaskIt(ByVal cols As DataColumnCollection) Implements IControlMaskit.MaskIt If Me.Mask <> "" Then Exit Sub End If Dim o As DataColumn = cols(Me.DataBindings.Item(0).BindingMemberInfo.BindingField) Dim cT As String = o.DataType.ToString If cT = "System.String" Then Me.Mask = ">" & New String("A", o.MaxLength) Exit Sub End If If cT = "System.DateTime" Then Me.Mask = ">##/AAA/##" Exit Sub End If MsgBox(Me.Name & " cannot be masked yet (" & cT & ")") End SubSo... is there a way to determine the "bound" table from a textbox that is bound to a field?