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

    Class not working

    Hi, it's me again.
    I've created a bot class wich contains three other classes called Skill1, Skill4 and Skill5. I declare a variable like Dim myBot as cBot
    set anarki = new cBot

    . When I try to acces a property of myBot like myBot.skill1.botname = "somename"

    then VB gives me the error "Object variable or With block variable not set". Can anybody please help me, I can't possibly figure ou what is wrong. If you want to have a look at the sourcecode (wich was too long to post here) you can try this download link http://botfactory.tripod.com/botfactoy.zip it's size is 558 KB. Thanks a lot


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Class not working

    I see from your code :

    >Dim myBot as cBot
    >set anarki = new cBot

    > When I try to acces a property of myBot like

    >myBot.skill1.botname = "somename"

    That you haven't actually assigned 'myBot' to anything.

    Shouldn't it be :


    Dim myBot as cBot
    set myBot = new cBot
    '
    myBot.Skill1.BotName = "SomeName"




    - If this isn't the problem, make sure that your 'cSkill' classes are being created in the cBot Class_Initialise routine.

    I tried to download your code, but Tripod just says that the file can't be found.



    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

  3. #3
    Join Date
    Oct 1999
    Location
    Holland
    Posts
    34

    Re: Class not working

    Sorry, I made two mistakes. I mistyped the second name, it should have been Anarki. I'm aware of that fact. Second, the correct URL for the zipfile is <URL>http://botfactory.tripod.com/botfactory.zip[/URL]


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