473,480 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Mask and dates

Hello all
I'm programming in a Windows form (VB 2005).
I use the MaskedTextBox control. I use the slash "/" as separator date.
When I retrieve data from a database in another workstation the separator
changes by depending the separator OS by defualt "-" or "."
How can I use the MaskedTextBox control always with "/"... or there is
anoter solution?

Thanks in advanced.
henpat
Dec 5 '06 #1
5 3669
On Tue, 5 Dec 2006 14:58:53 +0100, path wrote:
Hello all
I'm programming in a Windows form (VB 2005).
I use the MaskedTextBox control. I use the slash "/" as separator date.
When I retrieve data from a database in another workstation the separator
changes by depending the separator OS by defualt "-" or "."
How can I use the MaskedTextBox control always with "/"... or there is
anoter solution?

Thanks in advanced.
henpat
There is indeed! When it comes to inputing dates try and make use of the
calendar or the datepicker. It solves many common problems such as:
- Validation
- Use of separators
- Invalid dates e.g. 30 February
--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 5 '06 #2
Can you format the date into the MaskedTextBox control?
I used to use that in VB6 a lot, but haven't used it in .Net yet.
Something like maskedtextbox.text = format(myDate, "mm/dd/yy")
This must match the mask you have defined, and it forces
the incoming data into the same format. Does that help?

Robin S.
--------------
"path" <pa**@msn.comwrote in message
news:ON**************@TK2MSFTNGP05.phx.gbl...
Hello all
I'm programming in a Windows form (VB 2005).
I use the MaskedTextBox control. I use the slash "/" as separator date.
When I retrieve data from a database in another workstation the separator
changes by depending the separator OS by defualt "-" or "."
How can I use the MaskedTextBox control always with "/"... or there is
anoter solution?

Thanks in advanced.
henpat

Dec 5 '06 #3
Something like maskedtextbox.text = format(myDate, "mm/dd/yy")

AFAIK format() doesn't work on strings. Instead use:

maskedtextbox.text = mydate.tostring("MM/dd/yy")

Thanks,

Seth Rowe
RobinS wrote:
Can you format the date into the MaskedTextBox control?
I used to use that in VB6 a lot, but haven't used it in .Net yet.
Something like maskedtextbox.text = format(myDate, "mm/dd/yy")
This must match the mask you have defined, and it forces
the incoming data into the same format. Does that help?

Robin S.
--------------
"path" <pa**@msn.comwrote in message
news:ON**************@TK2MSFTNGP05.phx.gbl...
Hello all
I'm programming in a Windows form (VB 2005).
I use the MaskedTextBox control. I use the slash "/" as separator date.
When I retrieve data from a database in another workstation the separator
changes by depending the separator OS by defualt "-" or "."
How can I use the MaskedTextBox control always with "/"... or there is
anoter solution?

Thanks in advanced.
henpat
Dec 5 '06 #4
Thanks for providing the syntax for what I was going for!
Robin S.
-----------------------------
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
>Something like maskedtextbox.text = format(myDate, "mm/dd/yy")

AFAIK format() doesn't work on strings. Instead use:

maskedtextbox.text = mydate.tostring("MM/dd/yy")

Thanks,

Seth Rowe
RobinS wrote:
>Can you format the date into the MaskedTextBox control?
I used to use that in VB6 a lot, but haven't used it in .Net yet.
Something like maskedtextbox.text = format(myDate, "mm/dd/yy")
This must match the mask you have defined, and it forces
the incoming data into the same format. Does that help?

Robin S.
--------------
"path" <pa**@msn.comwrote in message
news:ON**************@TK2MSFTNGP05.phx.gbl...
Hello all
I'm programming in a Windows form (VB 2005).
I use the MaskedTextBox control. I use the slash "/" as separator
date.
When I retrieve data from a database in another workstation the
separator
changes by depending the separator OS by defualt "-" or "."
How can I use the MaskedTextBox control always with "/"... or there is
anoter solution?

Thanks in advanced.
henpat

Dec 5 '06 #5
Thanks a lot for your comments.
I'll try
best!
path
"RobinS" <Ro****@NoSpam.yah.noneescribió en el mensaje
news:i5******************************@comcast.com. ..
Thanks for providing the syntax for what I was going for!
Robin S.
-----------------------------
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
>>Something like maskedtextbox.text = format(myDate, "mm/dd/yy")

AFAIK format() doesn't work on strings. Instead use:

maskedtextbox.text = mydate.tostring("MM/dd/yy")

Thanks,

Seth Rowe
RobinS wrote:
>>Can you format the date into the MaskedTextBox control?
I used to use that in VB6 a lot, but haven't used it in .Net yet.
Something like maskedtextbox.text = format(myDate, "mm/dd/yy")
This must match the mask you have defined, and it forces
the incoming data into the same format. Does that help?

Robin S.
--------------
"path" <pa**@msn.comwrote in message
news:ON**************@TK2MSFTNGP05.phx.gbl...
Hello all
I'm programming in a Windows form (VB 2005).
I use the MaskedTextBox control. I use the slash "/" as separator
date.
When I retrieve data from a database in another workstation the
separator
changes by depending the separator OS by defualt "-" or "."
How can I use the MaskedTextBox control always with "/"... or there is
anoter solution?

Thanks in advanced.
henpat


Dec 6 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5030
by: Serious_Practitioner | last post by:
Hello, and thank you in advance for your help. Again. I want to enter the month and day portions only of a date into a table field. The idea is that I'll use the information later to generate a...
1
4625
by: John | last post by:
Hi What would be the input mask for a name field where first letter is caps and the rest lower? Its ideal if the mask can handle multiple names separated by a space but if not a single word will...
4
6974
by: chipshop | last post by:
Greetings all... I need to be able to input dates into a table in the following format: Saturday/29/October/2005 Could someone please tell me the input mask for this? I'm using Access...
4
7949
by: Russ | last post by:
Is it possible to create a input mask on a text box? If a user enters a date like this 060103 I would like to see it automatically converted to 06/01/03. In Access if you set a input mask to...
2
1890
by: Tai | last post by:
Hi all, I have an ASP.NET web project that requires some mask control for entering Birthday, SSN, Phone number. I searched on Google and found some mask controls that worked very well on IE. But...
16
12657
by: Filips Benoit | last post by:
Dear all, I have a datefield that sometimes should store hours and minutes too ans use following format and inputmask. dd/mm/yyyy hh\:nn 09/09/0000\ 99:99;0;* Typing date, hour and...
2
4482
by: jmarr02s | last post by:
I need my Date field to possess the following format: Jan-05-1999 How do I change the Date Format/Input Mask to accomplish this? Thanks! John
18
2892
JamesDC
by: JamesDC | last post by:
Hi, So I'm working with an Access 2002 database for waste managemnt. The person in my role before my put together the program before he left and now I'm in charge of it. After updating a few...
1
12213
by: Doug | last post by:
Hi, I created a short date field. The format is dd/mm/yyyy when displayed. The input mask is set to 99/99/00;0 (default, I didn't type anything). If I edit an existing date, say change...
0
6915
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7054
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7097
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3003
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.