Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. MaskEdBox

MaskEdBox

Scheduled Pinned Locked Moved Visual Basic
questionhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcm
    wrote on last edited by
    #1

    previously, when generating reports, I entered a range of dates by means 2 textboxes. However, for the purposes of validation, i found this an inadequate way (eg it allows entry of days > 31 etc). instead i have started to use an MaskEdBox, i have set the DataFormat to Date, how do i set the format to ##/##/####? does it have similiar properties to that of the textbox? (ie MaskEdBox.Text etc)any help would be greatly appreciated, i am a newbie to this control!Thank you!

    N R 2 Replies Last reply
    0
    • M mcm

      previously, when generating reports, I entered a range of dates by means 2 textboxes. However, for the purposes of validation, i found this an inadequate way (eg it allows entry of days > 31 etc). instead i have started to use an MaskEdBox, i have set the DataFormat to Date, how do i set the format to ##/##/####? does it have similiar properties to that of the textbox? (ie MaskEdBox.Text etc)any help would be greatly appreciated, i am a newbie to this control!Thank you!

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      mcm wrote: how do i set the format to ##/##/####? MaskEdBox1.Mask = "##/##/####" You will need to check the values to make sure that the user entered the correct values, I would suggest you write a function:

      Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
      'Do your stuff here...
      End Sub


      Nick Parker

      The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt

      1 Reply Last reply
      0
      • M mcm

        previously, when generating reports, I entered a range of dates by means 2 textboxes. However, for the purposes of validation, i found this an inadequate way (eg it allows entry of days > 31 etc). instead i have started to use an MaskEdBox, i have set the DataFormat to Date, how do i set the format to ##/##/####? does it have similiar properties to that of the textbox? (ie MaskEdBox.Text etc)any help would be greatly appreciated, i am a newbie to this control!Thank you!

        R Offline
        R Offline
        RichardGrimmer
        wrote on last edited by
        #3

        Why dont' you try a DTPicker control - resembles a Combo, but when you hit the drop-down, it shows a Month in a calendar control. Still possible to directly enter a date, but won't let you enter an invalid one. To use, right click your toolbox and select components. Scroll down the resulting list, and select "Microsoft Windows Common Controls 2 6.0 SP4", or browse to MSCOMCTL2.ocx. This will add the control to your toolbox, and can be used in the normal way. Help for the control is in MSDN under VBReference->Controls Reference->ActiveX COntrols (Apologies if the preceeding is teaching my granny to suck eggs!)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups