CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    Germany
    Posts
    106

    Access to class properties

    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


  2. #2
    Join Date
    Feb 2000
    Posts
    137

    Re: Access to class properties

    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


  3. #3
    Join Date
    May 1999
    Location
    Germany
    Posts
    106

    Re: Access to class properties

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured