VS.NET 7, Strict=ON, VB problem

M

Marc Champagne

Hi folks,

With the following code sample in a window's form (VB.NET
7)...


Structure CustomerRecord
<VBFixedString(12)> Public IDee As String
<VBFixedString(45)> Public Name As String
End Structure

Shared CusRec As CustomerRecord
Shared Cust(500) As CustomerRecord

Private Sub GetRecs()

Dim File As Integer
Dim Num As Integer = 0
Dim CustFile As String = "c:\cust.txt"

File = FreeFile()
FileOpen(File, CustFile, _
OpenMode.Random, , ,Len(CusRec))

While (Not EOF(File))
FileGet(File, CusRec) <<< problem is here
Cust(Num) = CusRec
Num = Num + 1
End While

FileClose(File)

End Sub


Using VS.NET 7, When Strict is ON, I am unable to get the
above to work, any ideas as to how I get it to work?

Type casting maybe? (if so, I'm unable to find the right
syntax)


The Task List shows the following:

Overload resolution failed because no accessible 'FileGet'
can be called with these arguments:

Many Thanks!

Marc
 
A

AlexB

I'm not certain but option Strict may not like the old vb
file access functions. You may need to use the new .net
file classes. I'll be rewriting your code with the
classes in system.io.file will resolve the problem.

Good luck.
 
M

Marc Champagne

I'm not certain but option Strict may not like the old vb
file access functions. You may need to use the new .net
file classes.

I tried to understand them, but my head just won't give in :)

For the time being, I turn strict-ON, adjust the code to
comply (to the exception of fileget) and then turn back
strict-OFF.
I'll be rewriting your code with the
classes in system.io.file will resolve the problem.

I don't understand what your are saying here.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top