473,500 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS.NET 7, Strict=ON, VB problem

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
Jul 21 '05 #1
2 1271
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.
-----Original Message-----
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
.

Jul 21 '05 #2
"AlexB" <an*******@discussions.microsoft.com> wrote in
news:00****************************@phx.gbl:
-----Original Message-----
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


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

--
Marc Champagne
marcch.AT.videoSPAMNOTtron.DOT.ca.invalid
Montreal, Canada
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2119
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care...
11
2096
by: Daylor | last post by:
hi. im using option strict on. im doing in ,from the simple reason ,to be warn when there are implict conversion like string to int ,int to string. BUT. the price ,(now i see ), is very bad....
1
2406
by: Eduardo Garcia-Prieto | last post by:
I have come accross a problem in using the Interlocked.Exchange(Object, Object) method while using Option Strict On in my project. I have a private class structure variable which can be updated...
13
2486
by: Shannon Richards | last post by:
Hello: I have a problem using ByRef arguments with Option Strict ON. I have built a generic sub procedure "ChangeValue()" to change the value of an argument if the new value is not the same as the...
30
1820
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care...
4
2999
by: Howard Kaikow | last post by:
I am trying to retrive some WMI properties using Option Strict On. This requires the use of InvokeMember. I know that there are alternative ways to get the values, but I want to learn how to...
3
1646
by: carlin smith via .NET 247 | last post by:
I have an option strict on problem. i am using the event for 1 button to be the event for several others, kind of like indexes in vb6. it looks something like this: ***** Private Sub...
2
289
by: Marc Champagne | last post by:
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...
6
423
by: Rob | last post by:
I have employed a "Singleton mode" of programming for this project. I have a class that exposes some properties of the class "Sample" to other forms.... If I set Option Strict On, I get many...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.