02-16-2007 05:17 AM
02-16-2007 10:51 AM
Hi bohm,
I think a maximum character property for the textbox control is an excellent suggestion. I'm afraid SUDialogs offer no built-in help for filtering or structuring the characters typed into a textbox. If you already have a filtering routine, then you are most of the way there. What I would suggest is that you declare a global Sub in the "Declarations" section and pass it the control object variable ("This"). That way you only have to have your filtering code in one place and you can call it from each textbox that needs the filtering, like this:
'(Declarations)
Sub FilterText(This, MaxLen)
Dim CurrCol, CurrLen
CurrCol = This.CurrentColumn
CurrLen = Len(This.Text)
If CurrCol > MaxLen Then
This.Text = Left(This.Text, MaxLen)
This.CurrentColumn = MaxLen
This.Refresh
Elseif CurrLen > MaxLen Then
This.Text = Left(This.Text, MaxLen)
This.CurrentColumn = CurrCol
This.Refresh
End If
End Sub
'End of (Declarations)
Sub EditBox1_EventChange()
Dim This : Set This = EditBox1
Call FilterText(This, 5)
End Sub
Sub EditBox2_EventChange()
Dim This : Set This = EditBox2
Call FilterText(This, 5)
End Sub
Hope that helps,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-16-2007 11:41 AM