Results 1 to 4 of 4

Thread: Public Types

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Public Types

    Hey all, i have a public type...

    Public Type secondCharacter
    shooting As String
    x As Long
    y As Long
    End Type

    simple enough but when i refer to it...

    secondCharacter.shooting = "Hello"

    i gte an object requiered error wen running in VB and when compiled varible not defined!

    any suggestions on why i am recieving this problem?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    You defined the Type, but not a variable of that type. ie Dim x As secondCharacter
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    If you only create a type, you have only created a new type for a variable. You must then declare a variable of that type.

    Like:
    VB Code:
    1. Dim YourVar as secondCharacter
    then you can use:

    VB Code:
    1. YourVar.shooting="hello"
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  4. #4

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