0

My form has a TextBox with values like(e.g: P011112, C0212102) those are products lot numbers that the user enters. Then, what i want is that a DateTimePicker takes the first 4 digits as "MM-yyyy" and add 3 years to that date.

Example: TextBox.text = P011112
DateTimePicker = January, 2014


Thanks in advance

2
Contributors
2
Replies
7
Views
5 Years
Discussion Span
Last Post by pipelian
1
Dim prod As String = "P011112"

Dim mm As Integer = CInt(prod.Substring(1, 2))
Dim yy As Integer = CInt(prod.Substring(3, 2))

MsgBox(MonthName(mm, False) & ", " & yy + 2003)    'output is "January, 2014"

Assumes that the digits in the string are valid for conversion to date.

Edited by Reverend Jim: n/a

0
Dim prod As String = "P011112"

Dim mm As Integer = CInt(prod.Substring(1, 2))
Dim yy As Integer = CInt(prod.Substring(3, 2))

MsgBox(MonthName(mm, False) & ", " & yy + 2003)    'output is "January, 2014"

Assumes that the digits in the string are valid for conversion to date.

Awesome...thank you so much!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.