Date

  • Thread starter Thread starter André Almeida Maldonado
  • Start date Start date
A

André Almeida Maldonado

How can I verify if a textbox that receives a date have or not a date??

Like IsDate vb6 function.....

Thank's
 
André Almeida Maldonado said:
How can I verify if a textbox that receives a date have or not a
date??

Like IsDate vb6 function.....

Use VB.NET IsDate function.
 
* "André Almeida Maldonado said:
How can I verify if a textbox that receives a date have or not a date??

Like IsDate vb6 function.....

'IsDate' still exists in VB.NET.
 
Thank's,

I know it, but it is not good to work with it... There is a class that can
do the same....


Thank's again...
 
How can I verify if a textbox that receives a date have or not a date??

Like IsDate vb6 function.....

Thank's

You can also "roll your own" IsDate function like so (But IsDate may
already do this):

Public Function IsDate(d As String) As Boolean
Try
DateTime.Parse(d)
Return True
Catch ex As Exception
Return False
End Try
End Function
 
* "André Almeida Maldonado said:
I know it, but it is not good to work with it... There is a class that can
do the same....

'DateTime.Parse'/'DateTime.TryParse' inside a 'Try...Catch' block.
 
Hi Herfried

Same question to you (I never use IsDate) but I am curious
can do the same....

Why is this your opinion?
'DateTime.Parse'/'DateTime.TryParse' inside a 'Try...Catch' block.

Cor
 
You can do this:

Try
Dim datevar
datevar = cDate(inputVar)
Catch
msgbox("Error, must enter a date")
End Try

Sean
 
Cause nobody knows if these functions still working in the next versions of
the Framework....
 
Hi Andre,
Cause nobody knows if these functions still working in the next versions of
the Framework....

And you are sure that that is with all other classes for sure?

Please give me the link, I am curious?

Cor
 
André Almeida Maldonado said:
Cause nobody knows if these functions still working in the next
versions of the Framework....

In addition to Cor,
the "MSVB.NET runtime" library is not the "MSVB.NET *compatibility*"
library.
 
Herfried,

In one of our arguing in the past I started accepting the Microsoft Visual
Basic words, because I did find it something rich from the language. I even
saw in a while in this newsgroup that in certain situations they are more
effective than the general system members. If necessary I will even use
them. (Although I have a big problem with the 1 start index and that is the
reason I avoid them).

But I think that it is good, when someone says I heard that it are not good
instructions, to act in the same way as Armin and I did in this thread.

And not give an answer. In this case I think I take Toms words: 'it is
better to learn someone how to fish than to give him a fish" (And then
adding my words if he not is starving).

Cor
 
Back
Top