Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MaskEdit
Message
 
To
28/06/1999 20:28:17
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00235026
Message ID:
00235045
Views:
19
>I have a MaskEdit control on my form with the following properties:
>- Format = "0"
>- Mask = "###"
>
>When assigning a value from code, I get all kinds of problems if rsContracts!Term < 100. With rsContracts!Term >= 100, I have no problem. Here what I've tried:
>1. MaskEdit.Text = rsContrats!Term => Error
>
>2. MaskEdit.Format = ""
>MaskEdit.Mask = ""
>MaskEdit.Text = rsContrats!Term
>MaskEdit.Format = "0"
>MaskEdit.Mask = "###" => Blank value
>
>3. MaskEdit.Text = Format(rsContrats!Term, "###") => Error
>
>4. MaskEdit.Text = Format(rsContrats!Term, "000") => Extra zero at the left (10 show up as 010)
>
>I'm short of ideas, so if someone have some, I would be pleased to hear them.
>
>TIA


I'm not exactly sure of what you but there is guess!!!

Place a MaskedBox control, a TextBox control and a CommandButton control on a from (without changing any properties). Then paste this code.

Private Sub Command1_Click()
With MaskEdBox1
.SelStart = 0
.SelLength = Len(.FormattedText)
.SelText = Text1.Text
End With
End Sub

Private Sub Form_Load()
MaskEdBox1.Mask = "###"
End Sub

Is working as you wish? If not, which part doesn't satisfy your needs?

The Format property is often use with date. IE, you use a mask for the input (like yyyy/mm/dd) and a different format for the display (like dd mmm yyyy).
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform