Question Need help with my registration system

ACiD.WAStE.Sarah

New member
Joined
Sep 14, 2010
Messages
2
Programming Experience
3-5
Hey forum;
Im making a registration service;
Snippet
VB.NET:
        If (Me.txtN.Text.Length < 2) Then
            MessageBox.Show("Need More Characters for the Name."), "Sorry.")
        Else
            Dim text As String = Me.txtN.Text
            Dim str2 As String = Form1.getHash([text])
            Dim num As Integer = 0
            Dim length As Integer = [text].Length
            Dim num3 As Integer = (((length * 8) + length) + &H3F)
            Dim i As Integer
            For i = 0 To str2.Length - 1
                num = (num + str2.Chars(i))
            Next i
            Dim str3 As String = String.Concat(New Object() {CInt(AscW([text].Chars((length - 1)))), num3, &H3F, num})
                    If (Me.txtS.Text = str3) Then
            MessageBox.Show("Successful; Thanks for registering " & txtN.Text, "Success!")
        Else
            MessageBox.Show("Unsuccessful; The name " & txtN.Text & vbNewLine & "and the License " & txtS.Text & " Do not match." & vbNewLine & " Try copy/pasting the license.", "Unsuccessful")
        End If
        End If

Im having troubles here
VB.NET:
            Dim i As Integer
            For i = 0 To str2.Length - 1
                num = (num + str2.Chars(i))
            Next i
This Is The Error said:
Operator '+' is not defined for types 'Integer' and 'Char'.
How do i fix this :3 ive tried making the Integer and Char into a CharArray but that didnt help any.
 
Try casting str2.Chars(i) into an integer before adding it to the num integer variable:
VB.NET:
            For i = 0 To str2.Length - 1
                num += CInt(str2.Chars(i)) 'Assumes str2.Chars(i) is a digit
            Next i
 
Back
Top