Home All Groups Group Topic Archive Search About
Author
5 Dec 2006 1:58 PM
path
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

Author
5 Dec 2006 6:00 PM
Rad [Visual C# MVP]
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
Author
5 Dec 2006 7:17 PM
RobinS
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.
--------------
Show quoteHide quote
"path" <p***@msn.com> wrote in message
news:ONkXBWHGHHA.1216@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
>
Author
5 Dec 2006 7:38 PM
rowe_newsgroups
> 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:
Show quoteHide quote
> 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" <p***@msn.com> wrote in message
> news:ONkXBWHGHHA.1216@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
> >
Author
5 Dec 2006 9:53 PM
RobinS
Thanks for providing the syntax for what I was going for!
Robin S.
-----------------------------
Show quoteHide quote
"rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message
news:1165347530.230619.82910@f1g2000cwa.googlegroups.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" <p***@msn.com> wrote in message
>> news:ONkXBWHGHHA.1216@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
>> >
>
Author
6 Dec 2006 9:12 AM
henpat
Thanks a lot for your comments.
I'll try
best!
path
Show quoteHide quote
"RobinS" <RobinS@NoSpam.yah.none> escribió en el mensaje
news:i5WdndOjnp7Ed-jYnZ2dnUVZ_h2dnZ2d@comcast.com...
> Thanks for providing the syntax for what I was going for!
> Robin S.
> -----------------------------
> "rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message
> news:1165347530.230619.82910@f1g2000cwa.googlegroups.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" <p***@msn.com> wrote in message
>>> news:ONkXBWHGHHA.1216@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
>>> >
>>
>
>