Hack Forums
[.NET] [VB.NET] Login system , little problem [VB.NET] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [VB.NET] Login system , little problem [VB.NET] (/showthread.php?tid=2225801)



[VB.NET] Login system , little problem [VB.NET] - SH3NZ1 - Feb 18, 2012

Hi everyone ,

I need your help for a login system coded by Sutton2k9.

Here is the Region "Function" :

Code
#Region "Function"
    Function GetCPUID()
        Dim cpuInfo As String = String.Empty
        Dim mc As New ManagementClass("win32_processor")
        Dim moc As ManagementObjectCollection = mc.GetInstances()
        For Each mo As ManagementObject In moc
            cpuInfo = mo.Properties("processorID").Value.ToString()
        Next
        Return cpuInfo
    End Function
    Function SystemSerialNumber() As String
        Dim wmi As Object = GetObject("WinMgmts:")
        Dim serial_numbers As String = ""
        Dim mother_boards As Object = wmi.InstancesOf("Win32_BaseBoard")
        For Each board As Object In mother_boards
            serial_numbers &= ", " & board.SerialNumber
        Next board
        If serial_numbers.Length > 0 Then serial_numbers = _
            serial_numbers.Substring(2)
        Return serial_numbers
    End Function
    Function GetID()

        Dim Str1 As String = GetCPUID()
        Dim Str2 As String = SystemSerialNumber()
        Dim HWID As String = String.Empty
        Do
            If Str1 <> String.Empty Then
                HWID += Str1.Last
                Str1 = Str1.Remove(Str1.Count - 1)
            End If
            If Str2 <> String.Empty Then
                HWID += Str2.Last
                Str2 = Str2.Remove(Str2.Count - 1)
            End If
        Loop Until Str2.Count = 0 And Str2.Count = 0
        Return HWID
    End Function
#End Region

I code this error :

[img]http://img11.hostingpics.net/pics/848830Sanstitre.png[/img]

"Last is not a member of String"
"Count is not a member of String"

So , my question is : By what can i replace Last & Count ?

LastIndexOf(HWID) ?

Thanks in advance.


* - MoBaT - Feb 18, 2012

Those should be members of string:

[img]http://screensnapr.com/e/TY93m3.png[/img]


* - SH3NZ1 - Feb 18, 2012

Str2 is solved , but str1 is not.

I can write str1 as string = "BLABLABLA"
Be cause str1 = the GetCPUID() function


* - ALPINE - Feb 18, 2012

try adding "As String" at the end of the function after the parameters like so

Code
Function Test() as String
End Function



* - SH3NZ1 - Feb 18, 2012

Doesn't work :x

Can i use Length ?