Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Nub Question (ActiveX Control)
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BioHazardousWaste




PostPosted: Wed Oct 06, 2004 4:06 pm   Post subject: Nub Question (ActiveX Control)

Hey guys... i've been pgrammin in vb for a few years now, so I know a fair bit about the standard .exe. I don't know everything though, I haven't really looked into windows API, Serial Port Communication, or FTP/Networks.... so there is still a fair bit I can learn. Anyways, I am trying to make a C&C type game, and I was getting really pissed off. So I pulled out my VisualBasic Black Book, and I found out how to make my own controls (e.x. a unit)... using ActiveX Control files. So, I sat down, coded a "unit" so that when you click on it, it shows HP bar, and rank icon... very nice, use arrays to create/delete units... all works very nicely. Except for one problem... I can't get the ObjectBag to work properly. What I want to do is pass in 2 values (strings). The picture of the unit (light tank, heavy tank w/e) and the picture of the units rank... so say i create a heavy tank. I want to set the two properties

UnitHeavyTank(1).UnitImage = *imagelocation*
UnitHeavyTank(1).RankImage = *imagelocation*

Now my book is talking about GetProperty and LetProperty... i copied the code out of there, but I couldn't get it to work (I don't have the book with me atm so I cant tell u exactly wut the code is). It does make a property so I can set it, but it doesn't SAVE it... for ex. my book has a calcutor ex. text3.text = text2.text + text1.text and you set the values of operand1 and operand2 (text1 and text2). I save the control and import it into my project, and it works fine, I change Operand1 to 5 and Operand2 to 2 BUT as soon as I click the play button, they reset to "Text1" and "Text2".... so I'm assuming i've screwed up on the property bag thing... If someone could show me how that works, it'd be awesome.

Also, can somebody direct me to a ActiveX Document/EXE/DLL tutorial or lesson or something? Thanx
Sponsor
Sponsor
Sponsor
sponsor
Brightguy




PostPosted: Thu Oct 07, 2004 10:13 am   Post subject: Re: Nub Question (ActiveX Control)

If I understood you correctly, you should have some code in your ActiveX control that resembles this:
code:
Property Let SetUnitImage(strImageLocation As String)
    imgUnit.Picture = LoadPicture(strImageLocation)
End Property

Property Let SetRankImage(strImageLocation As String)
    imgRank.Picture = LoadPicture(strImageLocation)
End Property

Post the code you're having trouble with if I missed the point here...
As for tutorials, I'm sure there must be some if you search around. A quick google search found this tutorial, but I'm not sure how good it is.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: