Hi
How can I right justify a number in a masked edit control with an input mask of "###,###,###"? It seems easy, but I can't figure it out. :confused:
Thanks.
Printable View
Hi
How can I right justify a number in a masked edit control with an input mask of "###,###,###"? It seems easy, but I can't figure it out. :confused:
Thanks.
Hi OneSource,
I think it is the method RSet.
for the response, but it didn't work. Here's my code:I threw the stTemp variable in there because it wouldn't let me do this:Code:Dim stTemp As String
stTemp = meStock.Text
RSet stTemp = meStock.Text
Does anyone know how to do this?Code:RSet meStock.Text = meStock.Text
Dim sPlace As String * 25
RSet sPlace = "Right->"
MsgBox sPlace
please try your code with the Masked Edit Control. Its behavior is different than a regular string variable.
Also, if you enter a number such as " 5 3 5", the masked edit control thinks that this is a valid number! :( It concatenates it into 535. Man, I may have to go back to text boxes! :(
Thx.
I don't have much experience with masked edit controls but don't you have an afterupdate or beforeupdate event in which you could check the len(maskeditcontrol) ? If it's 3 (length of 535), you don't accept it.
...and I don't know about aligning to the right! Sorry. Don't forget to post back the solution.
I just thought about it: because it has a mask, maybe the length will always be 5? I hope not. But if it does, you know it doesn't have 5 digits if it's < 10000.
Hope it helps.
I solved the problem by using a Format of "###,###,##0", checking whether the value is numeric in the Lost_Focus event, and making the MaxLengh of the Box 11, but allowing only 9 numbers to be typed by using the Change_Event and checking for the length of the string. By allowing only 9 letters, the comma's will be added to the number, if needed, after the focus is lost.
All the best.