Results 1 to 4 of 4

Thread: VB 2008 - Bad Record Length

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    7

    VB 2008 - Bad Record Length

    Hi there,

    I'm getting an error message when I try and save record data to a file.

    The error message I recieve says 'Bad Record Length', and highlights the following code - FilePut(filenum, customer)

    1. Can someone please explain to me what the error message means?

    2. Can anyone suggest a way to rectify it?

    Thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB 2008 - Bad Record Length

    Don't use FilePut. That's a VB6 holdover. You're using VB.NET so you should use it. Do file I/O using members of the System.IO namespace. If you explain what you're actually trying to achieve then we can suggest the best way to achieve it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    7

    Re: VB 2008 - Bad Record Length

    Sorry for the delayed reply.

    Basically, We have a structure set up, which holds some customer data - name, dob, address, deposit etc.

    We then write to a file (Random Access, as this was the tutorial followed)

    After much investigation, it appears that there is a limit on the number of bytes allowed? IS this right? if so, is there a way of extending the size? Or a quick add-on to allow it to work?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB 2008 - Bad Record Length

    I've never used FilePut and no VB.NET developer ever should. I don't know what limitations it has but they shouldn't be an issue. If you must use it then I can't be of help. If you don't have to use it then don't. Use a FileStream or a BinaryWriter. Even if you must use FilePut, you should ask your teacher why VB.NET has been around for almost 10 years and they are still teaching the VB6 way of doing things.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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