Solved

Visual Basic Input Mask?

Posted on 2004-04-12
5
2,482 Views
Last Modified: 2013-12-26
How do I create a date input mask in Visual Basic 6.  I want the text field to be formatted just like MS Access's Input box Function.  I want to be able to display a short date in the text field.  If I haven't been clear, create a form in MS Access and add one field.  Format that field date/time, select input box from the general procedure, select short date.  I need to see something like this!
##/##/####......I just want the end users to be able to enter the numbers not the slashes.

0
Comment
Question by:spzbiegien
5 Comments
 
LVL 9

Expert Comment

by:dancebert
ID: 10809358
Have you checked out VB's Masked Edit control?
0
 
LVL 11

Accepted Solution

by:
bingie earned 300 total points
ID: 10809371
Try this,

Add the Microsoft Masked Edit Control under Components (CTRL + T)

Then add this:

Private Sub Form_Load()
 MaskEdBox1.Mask = "##/##/####"
End Sub

Bingie
0
 
LVL 13

Expert Comment

by:Michael_D
ID: 10813248
There is better control to input and display date: DTPicker.
Try it !
0
 
LVL 27

Expert Comment

by:Dabas
ID: 10839812
I also vote for the DTPicker control

To get this control, click on Project -> Component
Check the box next to Microsoft Windows Common Controls -2
0
 

Expert Comment

by:pwappdev
ID: 11010031
Hey bingie,

I see that you already accepted a solution to your posted issue.

However, as I'm sure you know, and understand, the components Tab points back to COM objects.  

If you want a true .net assembly you might want to take a look at
Ted Schopenhouer's freeware on the codeproject.com website, which allows you to build your own assembly (Control) based on his initial source.

I've taken a look at it, and that's the route we're taking.

http://www.codeproject.com/vb/net/cpflexmaskeditbox.asp

Best wishes and good luck!

pwAppDev
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now