|
-
Sep 26th, 2000, 06:31 PM
#1
Thread Starter
Fanatic Member
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. 
Thanks.
-
Sep 26th, 2000, 06:42 PM
#2
Addicted Member
Hi OneSource,
I think it is the method RSet.
-
Sep 26th, 2000, 06:55 PM
#3
Thread Starter
Fanatic Member
Shark old friend, thanks
for the response, but it didn't work. Here's my code:
Code:
Dim stTemp As String
stTemp = meStock.Text
RSet stTemp = meStock.Text
I threw the stTemp variable in there because it wouldn't let me do this:
Code:
RSet meStock.Text = meStock.Text
Does anyone know how to do this?
-
Sep 26th, 2000, 07:02 PM
#4
Addicted Member
I think you need to declare spaces in the variable first.
Dim sPlace As String * 25
RSet sPlace = "Right->"
MsgBox sPlace
-
Sep 26th, 2000, 07:15 PM
#5
Thread Starter
Fanatic Member
Shark
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.
-
Sep 26th, 2000, 09:43 PM
#6
Hyperactive Member
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.
-
Sep 26th, 2000, 09:44 PM
#7
Hyperactive Member
...and I don't know about aligning to the right! Sorry. Don't forget to post back the solution.
-
Sep 26th, 2000, 09:45 PM
#8
Hyperactive Member
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.
-
Sep 27th, 2000, 08:12 AM
#9
Thread Starter
Fanatic Member
Krass, thanks for the response.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|