Results 1 to 2 of 2

Thread: List Box Error - Please Help!

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2014
    Posts
    6

    Exclamation List Box Error - Please Help!

    Hello,
    I am doing a project and I have created records to store students.
    I know that these records are storing because I used them for a log in system. However I am having difficulty displaying them.
    Here is the code I have used to display them in the code for the 'display' button:


    Dim Index As Integer 'declares index as integer
    Dim StudentRecord As StudentDetails 'one record
    Filename = "StudentDetails" 'here is where the user chooses the test

    FileOpen(1, Filename, OpenMode.Random, , , Len(StudentRecord)) 'opens records
    NumberOfRecords = LOF(1) / Len(StudentRecord)
    For Index = 1 To NumberOfRecords
    FileGet(1, StudentRecord) 'gets the correct file
    ListBoxSearchStudent.Items.Add(String.Format(MyFormat, StudentRecord.StudentUsername, StudentRecord.StudentPassword)) 'displays records
    ListBoxSearchStudent.Items.Add(" ")

    Next Index

    FileClose(1) 'closes the file


    However I am getting the error message 'Index (zero based) must be greater than or equal to zero and less than the size of the argument list.'.

    Please help!

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,927

    Re: List Box Error - Please Help!

    Welcome to VBForums

    Thread moved from the 'General Developer' forum to the 'VB.Net' (VB2002 and later) forum

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