advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
Tip of the Day
Rate this item | 0 users have rated this item.
Expertise: Advanced
Language: Visual Basic
November 20, 2000
Passing an ActiveX Control As a Parameter

Trying to pass an ActiveX control as a parameter to a method on an external ActiveX DLL (or EXE), garners a ”Type Mismatch” error. This error is peculiar, as it does not happen on a development computer. It occurs when the component is installed on another computer.

This problem has been recognized in the MSDN knowledge base under the article titled “PRB: Passing ActiveX Control to Component Gives ‘Type Mismatch’ Error Message.” The solution proposed in the knowledge base article is to make the receiving variable type ‘object’ so that it is assigned without throwing a ‘Type Mismatch’ error. This solution does not let you sink the events of the ActiveX control in the ActiveX DLL to which the control is being passed. In order to use the ‘WithEvents’ keyword, you need to declare your variable with the correct type of information, like Private WithEvents m_tree As TreeView. A solution to this problem is to refer to the ActiveX control in your DLL using ‘References’ instead of ‘Components.’

To do this, clear the entry corresponding to the ActiveX control in the ‘Project-Components’ dialog. Then open up ‘Project-Reference’ dialog and select the same ActiveX control. Compile the DLL and install. This will eliminate the type mismatch error when the application is run.
Mahesh Hegade
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
Please rate this item (5=best)
 1  2  3  4  5
advertisement
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs