actualli im creatin a database on the driving licnese issuing authority im a new vb user my problem is that i want the new validity date to be automatically displayed wen this text box is clicked the code im using is
dim text1 as date
dim text2 as date
text1.text= text2.text + 5 years
now this five years is giving error,....
plz suggest an accurate code for dis probelm soon thx

Recommended Answers

All 2 Replies

Try this and let me know if it worked...

Private Sub Form_Load()
Text1.Text = Format(Date, "mm/dd/yyyy")
End Sub

Private Sub Text1_Click()
Text2.Text = DateAdd("YYYY", 5, Date)
End Sub

hi Sroxx ...
you have strange code..
you declare text1 and text2 as date but you use both of them like textbox...
cometburn give a good post, try it.
and suggest for the event

Private Sub Text1_Change()
Text2.Text = DateAdd("YYYY", 5, Date)
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.