Click to See Complete Forum and Search --> : Access to class properties


pherweg
May 14th, 2000, 07:58 AM
Hello world,

i wrote a wrapper class for Strings (like CString in Visual C++). There is only one private property (the string of course), some methodes and of course property methods to get/let the string.
The property methods are the default property for the class.

Now the problem:
When i try to read a string from a file directly into my object, it doesn't work:


Dim s as new clsString
Dim f as Integer

f = FreeFile()
Open "C:\autoexec.bat" for input Access Read as #f
Line input #f, s
Close #f




What can i do?

help appreciated
Peter

Spectre
May 14th, 2000, 11:48 AM
Try:


Line input #f, s.PropertyName



Where PropertyName is the name of your string property. I know that if you have it set as the default property it should work your way, but I have found that sometimes you have to call the property name explicitly.
You also might try putting the read from the file into a VB String first, then passing that to the let property of your class.

Hope this helps.

Spectre

pherweg
May 15th, 2000, 08:39 AM
Thank you for you answer.

Using the property-name explictily doesn't work. VB seems to expect a VB-string as parameter.

Putting the read string in a VB-string first will work but this are 2 additional lines of code.

Isn't there a possibility to do it directly?

Bye
Peter