Results 1 to 3 of 3

Thread: Passing UDTs to object properties ?????

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Question

    I have a class with a public GET and LET to set and retrieve the location of the object. I want to pass a type called LOCATION which has an X and a Y value.

    But I always get "Only Public user types declared in public object modules can be used as parameters or return return types for public precedures or class modules... etc"

    I've tried declaring the type in the class and/or a public module, I tried public and private but I can't get it to work!

    I saw a question like this recently here re activeX controls but I'm not sure if this is related

    HELP!
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  2. #2
    Guest
    could you post a bit of code for us to have a butchers at?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    sure,

    I looked through some of the old posts and found the idea of using "Friend" rather than "Public" which seems to work, which is odd, an in depth explanation would be great!!

    Code:
    ' class props (now with friend, doesn't work with public)
    
    Friend Property Get UnitPosition() As Location
        UnitPosition = CurrentLoc
    End Property
    
    Friend Property Let UnitPosition(Loc As Location)
        CurrentLoc = Loc
    End Property
    
    ' Type
    
    Public Type Location
        X As Integer
        Y As Integer
        BaseWidth As Integer
    End Type
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

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