IMEI Number validation using VB.NET

dangerbear

Newbie
Apr 3, 2011
4
1
Hi ,

I had this on my blog.
blog(dot)hefin(dot)in

I just felt like sharing this information here..for many programmers may be looking for codes like these.

The Code Logic is very simple..

Problem : Validating a Correct IMEI Number. (For those who dont know what IMEI stands google for IMEI.)

Solution
In the TextBox Change event type the following...
Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
            If TextBox1.Text.Length = 15 Then
                          Dim IMEI As String = TextBox1.Text 
                          Dim cnt As Integer = 0 
                          Dim nw As String = ??
                   For Each c As Char In
                          IMEIcnt += 1
                            If cnt Mod 2 <> 0 Then
                                  nw += c
                            Else
                                 Dim d As Integer = Integer.Parse(c) * 2nw += d.ToString()
                            End If
                  Next
Dim tot As Integer = 0 
For Each ch As Char In nw.Remove(nw.Length ? 1, 1)
          tot +=Integer.Parse(ch)
Next
Dim chDigit As Integer = 10 ? (tot Mod 10)  
         If chDigit = Integer.Parse(IMEI(IMEI.Length ? 1)) Then
                  MsgBox(?Valid?) 
          Else
                  MsgBox(?Invalid?) 
         End If
    End If
End Sub

Hope this code is useful.
 
You can also get the make and model from the imei. The imei contains the type allocation code which contains the handset info. There is an online database that contains all TACs that you can query against
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock