joe_pool_is Posted April 14, 2004 Posted April 14, 2004 One of our contractors has left our company, and I have been unlucky enough to inherit his project. He was very experienced with VB6 and earlier, whereas I have only worked with VB.NET (for the last year or so) and C. A lot of his code looks like this:Public Event AddImage() Private Sub HandleAddImage() RaiseEvent AddImage() End Sub Public Function Add(...) As Layer .... AddHandler MyLayer.AddImage, AddressOf HandleAddImage() .... End Function Public Sub Remove(...) .... RemoveHandleer MyLayer.AddImage, AddressOf HandleAddImage .... End SubCould someone give me an idea of what this code is supposed to be doing? Is this a good way to write this code? It looks very wordy to me. Quote Avoid Sears Home Improvement
iebidan Posted April 14, 2004 Posted April 14, 2004 It's been a long long long time since I wrote something in VB6, but I can recommend you to go to http://visualbasicforum.com/ this is the big brother of Xtreme .NET forums, they can help you better than us. Quote Fat kids are harder to kidnap
AlexCode Posted April 15, 2004 Posted April 15, 2004 Hi... In my opinion, and speaking about half a dozen lines of code, this is the way your ex-partner found to reuse his code... Somewhere around you r code must be a sub called 'HandleAddImage' isn't it? This way, whenever the 'MyLayer.AddImage' event occurs it call the ''HandleAddImage' method to handle it... This coding method can be highlly usefull if you're managing several 'MyLayer' objects at the same time, so you don't have to repeat code... Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.