i am having problem with a piece of code in vb.net.In this the flow of control goes to the else condition even though the value in if is true.
I had used this as input: WD-WXK0AC9T7316
code:
Private Function EncryptHDKey(ByVal Hd_no As String) As String
Dim EncryptedString As String = ""
For Each ch As Char In Hd_no
If ((ch >= "0" And ch <= "9") Or (ch >= "a" And ch <= "z") Or (ch >= "A" And ch <= "Z")) Then
If (Convert.ToChar((Convert.ToInt16(ch) + 4)) > "9" And ch <= "9") Then
EncryptedString = EncryptedString + Convert.ToChar((Convert.ToInt16(ch) + 3) - Convert.ToInt16("9"))
Else
If (Convert.ToChar((Convert.ToInt16(ch) + 4)) > "z" And ch <= "z") Then
EncryptedString = EncryptedString + Convert.ToChar(Microsoft.VisualBasic.Asc("a") + (Convert.ToInt16(ch) + 3) - Microsoft.VisualBasic.Asc("z"))
Else
If (Convert.ToChar(Convert.ToInt16(ch) + 4) > "Z" And ch <= "Z") Then
EncryptedString = EncryptedString + Convert.ToChar(Microsoft.VisualBasic.Asc("A") + (Convert.ToInt16(ch) + 3) - Microsoft.VisualBasic.Asc("Z"))
Else
EncryptedString = EncryptedString + Convert.ToChar(Convert.ToInt16(ch) + 4)
End If
End If
End If
Else
EncryptedString = EncryptedString + ch
End If
Next
Return (EncryptedString)
End Function
I don't have screenshot uploading privileges yet, so I have uploaded screenshot at this location. www(dot)freeimagehosting(dot)net/y6ea3