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.tx t"
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 2 1283
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.tx t"
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 .
"AlexB" <an*******@disc ussions.microso ft.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.tx t"
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.video SPAMNOTtron.DOT .ca.invalid
Montreal, Canada This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 about Option Strict?
What advantages do I get with Option Strict On?
Does better type statement make my code run faster?
If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but
I would once and for all like to know what the...
|
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.
if i have class CCar and interface ICar
when im doing this :
ICar = new CCar
|
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 by a separate thread. In order to guarantee that the
variable can be updated in an atomic operation it occurred to me that
I could use Interlocked.Exchange.
Class MyClass
Private Structure MyStructure
|
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 original value...To
accommodate all variable types I made the arguments in ChangeValue() of type
object...I then check the typecode and do the correct comparison etc...
With Option Strict ON I have to cast the arguments to the generic object...
|
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 about Option Strict?
What advantages do I get with Option Strict On?
Does better type statement make my code run faster?
If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but
I would once and for all like to know what the...
| |
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 use WMI with InvokeMember and Option Strict On.
I'm getting an "Unknown Name" error in the following statement in the code
below.
objProp = typeObjProps.InvokeMember("Item", _
|
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 btnNum0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNum0.Click, btnNum1.Click
if sender.tag = "1" then blah blah blah
*****
|
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 Structure
|
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 "Option Strict On disallows late
binding" errors (see below)
How might I fix this ?
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |