Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Text Box Mask

Posted on 2000-03-14
9
Medium Priority
?
2,275 Views
Last Modified: 2008-03-06
I have a textbox that I want a date to be entered into.  How do I get the textbox to do the date mask "__/__/__"?

Thanks
0
Comment
Question by:tdove
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:Catouch
ID: 2615828
In the propeties of your textbox,look in the dataformat. Pick date and you have several possibilities of date formats.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2615866
The DataFormat properties works if your control is bound.

You have at least 2 easy solutions:
1- Use the Date Time Picker control than comes with VB6 and allow to display a calendar and only accept valid date without any code.

2- Use the Mask Edit Control with the Mask property set to ##/##/##. You will have to ensure yourself that the date inputted by the user is valid.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2616305
DateTimePicker is generally to prefer
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:damienm
ID: 2616335
I use 3 text boxes and 2 labels with "/", when length of text1 = 2 then text2 set focus, when lenght of text2 = 2 then text3 setfocus etc.  It works the same as having 1 text box.

textbox1  "/"  textbox2  "/"  textbox3
0
 
LVL 4

Expert Comment

by:dreamvb
ID: 2616553
here is something I uses before you will have to edit it a little bit it the only thing I can think of with out Useing other Controls

'Place into textBox On_Change Event

Private Sub Text1_Change()
 Select Case Len(Text1)
  Case 2
  Text1.SelText = "/"
 Case 4
   Text1.SelText = "/"
  End Select
 
End Sub

'Just Enter something like 14/2/88
0
 

Author Comment

by:tdove
ID: 2616685
emoreau-

On the datepicker how does that affect mcn.execute INSERT INTO Employees(empName) VALUE (Text3.Text)?  Is the DT picker stilled considered text3.text...
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 300 total points
ID: 2616796
You have a value property that return the selected date in a date format.

You can then use it in select queries like this:
mcn.execute "INSERT INTO Employees(empName, empBirthDate) VALUES ('" & txtName.Text & "', '" & format(dtpicker1.value, "yyyy/mm/dd") &"')"  
0
 

Author Comment

by:tdove
ID: 2616881
Adjusted points from 50 to 75
0
 

Author Comment

by:tdove
ID: 2616882
Thanks Again Emoreau!

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

610 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