hi again..
Could sure use some help in another code I am currently working on. Would really appreciate the help.
Today i am trying to convert a date i put in a textbox(txtJulian) to a normal date like 02/05/2011(or any other conversion depending what is imputed in the textbox). I cant get it to print to correct date. When I type 011-2011 it print out 1/11/2000 when I want it to print 1/11/2011. Also the error messag doesnt show when I type nothing or the correct format in the txt box. Here is my code
Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
'holds the value of what the user inputs in the textbox
Dim JulianDate As Long
Dim 2Centuries As Long
Dim ConvertToJulianDate As Date
If txtJulian.Text = "" Or txtJulian.Text = Format("DDD - YYY") Then
lblOut.Text = "Julian date must have a dash"
End If
'Prompts the user to input in textbox and assign the value entered to
' then JulianDate
JulianDate = Val(txtJulian.Text)
'converts julian date to a regular date
If Int(JulianDate / 1000) < 30 Then
2Centuries = 2000
Else
2Centuries = 1900
End If
ConvertToJulianDate = DateSerial(Century + Int(JulianDate / 1000), _
1, JulianDate Mod 1000)
'Display the new date in the normal date format.
lblOut.Text = ConvertToJulianDate
End Sub
End Class
Thank you