Hello,

I want to add column names and proper columns to my list box and I couldn't find a way to do this. I have a books.dat file where all the records are stored and this is the code I have under the Display button which is meant to display the books file according to MyFormat coordinate settings.

Code:
 Dim Index As Integer
        lstDisplayFile.Items.Clear()
        Filename = "Books.dat"
        FileOpen(1, Filename, OpenMode.Random, , , Len(OneBook))
        BooksInFile = LOF(1) / Len(OneBook)
        FileClose(1)

        Filename = "Books.dat"
        FileOpen(1, Filename, OpenMode.Random, , , Len(OneBook))
        For Index = 1 To BooksInFile 'looks through all the records in the file
            FileGet(1, OneBook)
            lstDisplayFile.Items.Add(String.Format(MyFormat, OneBook.Title, OneBook.AuthorName, OneBook.AuthorSurname, OneBook.deweyid, OneBook.ClassOfBook, OneBook.ISBN, OneBook.DateAdded, OneBook.Price))
        Next Index
        FileClose(1)
Here is MyFormat declaration:
Code:
Dim MyFormat As String = "{0, -5}{1, -21}{2, -6}{3, -10}{4, -5}{5, -10}{6, -5}{7, -10}"
I'm doing this for a school project so I would appreciate a quick reply and not too complicated solution . What I currently use are labels above the columns where the fields are supposed to be but often they don't display in the right places, for example:


They're all spread out; is there any way to also rectify this?