Results 1 to 5 of 5

Thread: made up properties for objects

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    USA all the way!
    Posts
    82

    Exclamation made up properties for objects

    I am making an RPG and need some help.
    I set up the characters like this:

    Global Char(1 to 5) as new Char

    with Char being a new class module. I would like to put some properties in the class module so that i could do something like this in my main form:

    Char(1).Item1="Sword"
    Char(1).Name="Bush"

    anyone know how i might do this?
    Often talked of, never seen,
    Ever coming, never been,
    Daily looked for, never here,
    Still approaching, coming near,
    Thousands for its visit wait,
    But alas for their fate,
    Tho' they expect me to appear,
    They will never find me here.

    What's this about?

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Use the Visual Basic Class Builder. Alternatively, if you're only using the properties and not methods or events, you'll also want to look into Types (they're faster).
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Addicted Member Virtual24's Avatar
    Join Date
    May 2001
    Posts
    228
    Its much easier to use your own User defined type...

    Type [put type name here, such as RPGChar]
    Item1 as String
    Name as String
    End Type

    then u can use it like this:
    Public MyRGBChar as RGBChar

    Command1_Click()
    MyRGBChar.Name = "Bush"

    ... and so on

    you can also try putting and array of strings in you user defined type (like
    Item(1 to 5) as string
    would give you 5 'Items' variables

    Hope this helps....
    To protect time is to protect everything...

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    USA all the way!
    Posts
    82
    Thanks alot. This helped me an enormous amount
    Often talked of, never seen,
    Ever coming, never been,
    Daily looked for, never here,
    Still approaching, coming near,
    Thousands for its visit wait,
    But alas for their fate,
    Tho' they expect me to appear,
    They will never find me here.

    What's this about?

  5. #5
    Addicted Member Virtual24's Avatar
    Join Date
    May 2001
    Posts
    228
    Glad i could help.
    To protect time is to protect everything...

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