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