i have a problem here. I need to change the year automatically...ie i have given year 2009 in the text box, but it should change along with the change of the year................do anyone know the code for this......if so please help me thnks

Recommended Answers

All 2 Replies

You can use DateTime.Today.Year to get the current year. I use Math.Min() and the year it was compiled to stop an older year from showing up since you know it must be >= compiled year.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
	TextBox1.Text = Math.Min(DateTime.Today.Year, 2009)
End Sub

thanks for the code, but another problem is that i also need coding for automatic change of serial number. do we have any coding for it?????
thanks a lot

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.