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...
Hope this code is useful.
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.