Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Trouble in Compile, No Output

$
0
0
I am making a simple key coding program, i am facing compiling problem, that always show null result, i wrote its equation correct but why its out put null, can anyone help me to find out result. i also attach my code...

Private Function bincode(ByVal st As String) As String
        Dim result As String
        Try
            Dim str As String = ""
            Select Case st
                Case "2"
                    str = "00000"
                Case "3"
                    str = "00001"
                Case "4"
                    str = "00010"
                Case "5"
                    str = "00011"
                Case "6"
                    str = "00100"
                Case "7"
                    str = "00101"
                Case "8"
                    str = "00110"
                Case "9"
                    str = "00111"
                Case "A"
                    str = "01000"
                Case "B"
                    str = "01001"
                Case "C"
                    str = "01010"
                Case "D"
                    str = "01011"
                Case "E"
                    str = "01100"
                Case "F"
                    str = "01101"
                Case "G"
                    str = "01110"
                Case "H"
                    str = "01111"
                Case "J"
                    str = "10000"
                Case "K"
                    str = "10001"
                Case "L"
                    str = "10010"
                Case "M"
                    str = "10011"
                Case "N"
                    str = "10100"
                Case "P"
                    str = "10101"
                Case "Q"
                    str = "10110"
                Case "R"
                    str = "10111"
                Case "S"
                    str = "11000"
                Case "T"
                    str = "11001"
                Case "U"
                    str = "11010"
                Case "V"
                    str = "11011"
                Case "W"
                    str = "11100"
                Case "X"
                    str = "11101"
                Case "Y"
                    str = "11110"
                Case "Z"
                    str = "11111"
            End Select
            result = str
        Catch exception As Exception
            result = ""
        End Try
        Return result
    End Function

    Private Function toobinary(ByVal st As String) As String
        Dim result As String
        Try
            Dim str As String = ""
            While st.Length <> 0
                Dim str2 As String = st(0).ToString()
                str += bincode(str2)
                st = st.Substring(1)
            End While
            result = str
        Catch exception As Exception
            result = ""
        End Try
        Return result
    End Function

    Public Function DecryptString(ByVal [me] As ULong) As ULong
        Dim result As ULong
        Try
            Dim num As ULong = [me] Mod 10UL
            [me] /= 10UL
            Dim num2 As ULong = 0UL
            While [me] <> 0UL
                Dim num3 As ULong = [me] Mod 10UL
                If num3 < num Then
                    num3 += 10UL
                End If
                Dim num4 As ULong = num3 - num
                num2 = num2 * 10UL + num4
                [me] /= 10UL
            End While
            result = num2
        Catch exception As Exception
            result = 0UL
        End Try
        Return result
    End Function

    Public Function toodec(ByVal st As String) As ULong
        Dim result As ULong
        Try
            Dim str As String = toobinary(st)
            Dim num As ULong = 0UL
            Dim i As Integer = 0
            While str.Length <> 0
                Dim num2 As ULong = Convert.ToUInt64(str(str.Length - 1)) - 48UL
                num += num2 * CULng(Math.Pow(2.0, CDec(i)))
                str = str.Substring(0, str.Length - 1)
                i += 1
            End While
            result = num
        Catch exception As Exception
            result = 0UL
        End Try
        Return result
    End Function

    Public Function [date](ByVal st As String) As Integer
        Dim result
        Try
            Dim num As ULong = toodec(st)
            num = DecryptString(num)
            Dim hashCode As Integer = "RGZCCW3P2EJBC3G352ZB".GetHashCode
            If hashCode < 0 Then
                hashCode *= -1
            End If

            Dim i2 As Int64 = 103287435787683895

            Dim l As Long = CLng(hashCode)
            l = l * 100000000L
            Dim ul As ULong = CULng(l)
            ul = ul - num
            Dim I As Integer = CInt(ul)
            result = I
            'result = CInt((num - CULng((CLng(hashCode) * 100000000L))))
        Catch exception As Exception
            result = 0
        End Try
        Return result
    End Function

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>