Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / June 2006



Tip: Looking for answers? Try searching our database.

Visual Basic Input

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vballmatt - 27 Jun 2006 20:28 GMT
I've got this piece of code.

Input #1, modMain.cSettings.correctionFactor

I am inputting a Double.  modMain is a module, cSettings is an instance
of a class I created, and correctionFactor is a member variable of
cSettings, type double.  When I try to execute this command, I get the
error:

Compile error:
Variable required - can't assign to this expression

I think that it has to do with the fact that I have somehow not defined
the correctionFactor yet, so it doesn't view this as a variable.  If
anyone's got some help, I'd really appreciate it.

vballmatt
Steve Gerrard - 28 Jun 2006 04:32 GMT
> I've got this piece of code.
>
[quoted text clipped - 11 lines]
> the correctionFactor yet, so it doesn't view this as a variable.  If
> anyone's got some help, I'd really appreciate it.

No, a property of a class is not a variable - it is actually a pair of
procedures (Get and Let). Even if you just do
   Public correctionFactor As Double
in your class, VB will compile in the Get and Let procedures for you.

The simple solution is
   Dim Temp As Double
   Input #1, Temp
   modMain.cSettings.correctionFactor = Temp

What is with the #1, by the way, you should be using
   F = FreeFile
   Input #F, Temp
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.