שתף באמצעות


how Extract a Date of Birth and gender from an ID Number

Question

Friday, April 20, 2018 12:17 AM

how Extract a Date of Birth, citzen and gender from an ID Number  using data base in vb 

have 4 textbox for txtdob,txtgender,citzen(readonly)

then txt.idnumber

can have 3 buttons 

test and search,add

All replies (3)

Friday, April 20, 2018 12:35 AM

Hi

Please show examples of ID and their format.

Which portions of the ID are for DOB, which for citizen and for gender?

For example, an ID of 2002052202041 might mean

first 4 characters for year of DOB, followed by 2 characters for month of DOB followed by 2 characters for day of DOB followed by 4 characters for citizen and finally 1 character for gender

I don't know what is meant by citizen, but that example is purely to ask you to say how your ID is made up.

Regards Les, Livingston, Scotland


Friday, April 20, 2018 3:35 AM

how Extract a Date of Birth, citzen and gender from an ID Number  using data base in vb 

Do you mean something like this:
http://1bestcsharp.blogspot.com.au/2016/09/vb.net-search-record-in-sql-server.html


Friday, April 20, 2018 8:36 AM | 1 vote

Hi khaka,

please first post your IdNumber here. I do one example that you can also take a look. For example that IdNumber is 8501016184086, I just get year month and day for you, but you can refer to the following to get the value that you want.

 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        fun("8501016184086")
    End Sub

    Public Sub fun(idNumber As String)
        Dim year = idNumber.Substring(0, 2)
        Dim currentYear = DateTime.Now.Year Mod 100
        Dim prefix = "19"
        If +year < currentYear Then
            prefix = "20"
        End If
        Dim month = idNumber.Substring(2, 2)
        Dim day = idNumber.Substring(4, 2)
    End Sub

http://knowles.co.za/generating-south-african-id-numbers/

Best Regards,

Cherry

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.