Results 1 to 4 of 4

Thread: Code doesnt work when im adding some other code...[Solved]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2003
    Location
    Greece, Salonica
    Posts
    473

    Question Code doesnt work when im adding some other code...[Solved]

    Hi...
    When im adding some code, all of the other code stops working
    Here's the code:
    VB Code:
    1. If Left$(strData, 9) = "USERLOGIN" Then
    2.         strArray2 = Split(strData, vbCrLf)
    3.         If ReadINI(App.Path & "\users.ini", Right$(strArray2(1), Len(strArray2(1)) - 13), "Password", vbNullString, 100) = Right$(strArray2(2), Len(strArray2(2)) - 13) Then
    4.             '<:-) :WARNING: Empty String assignment updated to use vbNullString
    5.             '<:-) :PREVIOUS CODE : If ReadINI(App.Path & "\users.ini", Right$(strArray2(1), Len(strArray2(1)) - 13), "Password", "", 100) = Right$(strArray2(2), Len(strArray2(2)) - 13) Then
    6.             If ReadINI(App.Path & "\users.ini", Right$(strArray2(1), Len(strArray2(1)) - 13), "Banned", vbNullString, 100) = "True" Then
    7.                 '<:-) :WARNING: Empty String assignment updated to use vbNullString
    8.                 '<:-) :PREVIOUS CODE : If ReadINI(App.Path & "\users.ini", Right$(strArray2(1), Len(strArray2(1)) - 13), "Banned", "", 100) = "True" Then
    9.                 sckIntro(Index).SendData "BANNED"
    10.                 Exit Sub
    11.             End If
    12.             If lstUsers.ListCount < 20 Then
    13.               sckIntro(Index).SendData "FULL"
    14.               Exit Sub
    15.             End If
    16.          
    17.        [b]     Dim i As Integer
    18.             For i = 0 To lstUsers.ListCount - 1
    19.             lstUsers.ListIndex = i
    20.             If lstUsers.Text = Right$(strArray2(1), Len(strArray2(1)) - 13) Then
    21.             sckIntro(Index).SendData "ALREADYLOGGEDIN"
    22.             Exit Sub
    23.             Next i
    24.             End If[/b]
    25.            
    26.             sckIntro(Index).SendData "GOODLOGIN"
    27.             lstActions.AddItem "[" & Format$(Time, "hh:mm:ss") & "] " & Right$(strArray2(1), Len(strArray2(1)) - 13) & " has connected."
    28.             AddHScroll lstActions
    29.          Else 'NOT READINI(APP.PATH...
    30.             sckIntro(Index).SendData "BADLOGIN"
    31.             lstActions.AddItem "[" & Format$(Time, "hh:mm:ss") & "] Someone tried to login with a bad username or password!"
    32.             AddHScroll lstActions
    33.         End If
    34.     End If
    The code works fine without the bolded part...
    When i add it, the code stops working and its giving errors!
    What should i do?

    Thanks!
    Last edited by mike2; Jun 27th, 2004 at 03:59 PM.

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    You should go into Debug mode and find out where and why its erroring

  3. #3
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    VB Code:
    1. Dim i As Integer
    2.            
    3.             For i = 0 To lstUsers.ListCount - 1
    4.            
    5.             If lstUsers.List(i) = Right$(strArray2(1), Len(strArray2(1)) - 13) Then
    6.             sckIntro(Index).SendData "ALREADYLOGGEDIN"
    7.             Exit Sub
    8.             End If
    9.            
    10.             Next i

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2003
    Location
    Greece, Salonica
    Posts
    473
    Ahhh thank you that did it
    How stupid i was...
    I had to put next i after end if

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width