ID Number and Date of Birth

Posted by Paprikano under VB.NET on 8/24/2012 | Points: 10 | Views : 1675 | Status : [Member] | Replies : 0
Ok , so I have this code which extracts the DOB from the ID Number

Protected Sub txtUser_ID_Number_TextChanged(sender As Object, e As EventArgs) Handles txtUser_ID_Number.TextChanged
txtdob.Enabled = False
txtdob.Text = txtUser_ID_Number.Text.Substring(4, 2) & "/" & txtUser_ID_Number.Text.Substring(2, 2) & "/" & "19" & txtUser_ID_Number.Text.Substring(0, 2)
'txtdob2.Text = txtUser_ID_Number.Text.Substring(2, 2) & "/" & txtUser_ID_Number.Text.Substring(4, 2) & "/" & "19" & txtUser_ID_Number.Text.Substring(0, 2)
LinkSubmit.Visible = True
LinkTakeTest.Visible = False
LinkLogout.Visible = False
LinkCancel.Visible = True
txtEmail_Address.Focus()
End Sub

the id number does a an autopostback inorder for the DOB control to be populated with the DOB

the problem is, if a user just decides to go back and remove the ID Number from the txtUSer_ID_Number control, the post back will still happen and then
the DOB control will still be expecting values.

it gives back this error:
startIndex cannot be larger than length of string.
Parameter name: startIndex

is there another way that I can do the same thing but not get that error?




Responses

(No response found.)

Login to post response