Results 1 to 9 of 9

Thread: Masked Edit. I'm starting to regret it!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Thumbs down

    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.

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    Hi OneSource,

    I think it is the method RSet.
    Mako Shark
    Great White

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    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?

  4. #4
    Addicted Member
    Join Date
    May 2000
    Posts
    247

    I think you need to declare spaces in the variable first.

    Dim sPlace As String * 25
    RSet sPlace = "Right->"
    MsgBox sPlace
    Mako Shark
    Great White

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    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.

  6. #6
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    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.
    Chris

  7. #7
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    ...and I don't know about aligning to the right! Sorry. Don't forget to post back the solution.
    Chris

  8. #8
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    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.
    Chris

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    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
  •  



Click Here to Expand Forum to Full Width