Advertisement

07.17.2008 at 07:31AM PDT, ID: 23573311
[x]
Attachment Details

Cannot get file length

Asked by ss002d6252 in Microsoft Visual Basic.Net

Tags: microsoft, visual basic.net

Ive got a file - lessons.dat - that I am trying to read data from as a random access file. The file opens without error but wont pick up the length of the file or show the number of records.

The dat file is one continous line of text at the moment of a few hundred characters (file is 326bytes)- so should so a record count greater than 1

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
Dim lessons As Lessons1
 
        FileClose(1) 'closes file if already open to stop error
 
        FileOpen(1, "Lessons.dat", OpenMode.Random, , , Len(lessons))
 
        Dim Records As Short
        Records = LOF(1) / Len(lessons)
        MessageBox.Show(LOF(1))
        MessageBox.Show(Records)
 
-----------------------------------------------------
 
Module Lessons
 
    Structure Lessons1
 
        Dim DaysSince As Short
        Dim Slot As Short
        Dim PersonCode As Short
        <VBFixedString(30)> Dim FirstLine As String
        <VBFixedString(20)> Dim Town As String
        <VBFixedString(9)> Dim Postcode As String
'total length of 65 bytes
 
    End Structure
 
End Module
[+][-]07.17.2008 at 08:14AM PDT, ID: 22026336

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.17.2008 at 08:15AM PDT, ID: 22026357

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.17.2008 at 06:55PM PDT, ID: 22032325

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: microsoft, visual basic.net
Sign Up Now!
Solution Provided By: GeneM
Participating Experts: 3
Solution Grade: A
 
 
[+][-]08.23.2008 at 07:29AM PDT, ID: 22297104

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 03:17PM PDT, ID: 22302234

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 07:43PM PDT, ID: 22341839

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628