Solved

Text Box Mask

Posted on 2000-03-14
9
2,265 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
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 69

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 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2616305
DateTimePicker is generally to prefer
0
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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 69

Accepted Solution

by:
Éric Moreau earned 75 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 51
Put text in a picture ASP.NET C# 2 37
Copy a row 12 53
VBA: Select SQL query based on a config Sheet v2 11 30
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

18 Experts available now in Live!

Get 1:1 Help Now