Computer Science Canada

unique username

Author:  unoho [ Sat Dec 20, 2008 8:07 pm ]
Post subject:  unique username

hi guys, im trying to make a unique username login page in vb6 using random access file method.

this is what i have

this is a basic concept of chequing a unique name.

code:

Private Sub Command1_Click()
    strI = "i am a cow"
    lngID = 1
    For i = 1 To Len(strI)
        lngID = Asc(Mid(strI, i, 1)) * lngID
    Next i
   
    strI = "woc a ma i"
    lngID2 = 1
    For i = 1 To Len(strI)
        lngID2 = Asc(Mid(strI, i, 1)) * lngID2
    Next i
   
    If lngID = lngID2 Then
        strmsg = "unavailable"
    Else
        strmsg = "available"
    End If
   
    MsgBox lngID & vbNewLine & lngID2 & vbNewLine & strmsg
    End
   
End Sub



and it outputs "unavailable" because when they are multiplied, it outputs the same result for both the lngID and lndID2. anyone got any idea how to make it unique?


: