Results 1 to 3 of 3
  1. #1

    VB 6 Masked Edit control

    Question...I am using the MS Masked edit control on my vb 6 form to enter a date. How can I run the validation on it to make sure it is a valid date? I have come to the conclusion that I am going to have to write my own procedure for this but her is where the problem is:
    If I set the mask property to 99/99/9999 and the format property to MM/DD/YYYY the control works fine, except when I try to get the value of the textbox.
    If I enter 01/01/01 and tab out of the control the value changes to 01/01/2001 (fine, that's what I want) but if I display the value of the textbox in a messagebox it will still show as 01/01/01 ????? Is there a way to work around this? I thought of the lost_focus and validation events but it did the same thing.


  2. #2

    Re: VB 6 Masked Edit control

    I'm coming from VBA, but this should work.

    Use the Format command, like in the LostFocus Event, or wherever works for you, of the text box,

    <pre>Private Sub Text1_LostFocus()
    Text1.Text = Format(Text1.Text, "mmmm d, yyyy")
    End Sub

    That should do it.

    Works for me. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  3. #3

    Re: VB 6 Masked Edit control

    Yup that did it!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts