Print Page | Close Window

Error converting type...

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=266
Printed Date: 27 April 2024 at 10:32am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Error converting type...
Posted By: random0000
Subject: Error converting type...
Date Posted: 04 December 2003 at 4:44am

I am trying to implement a plugin system using your command bars and need to be able to have individual 'click' events for each commandbarcontrolbutton.

I created my own class inheriting the CodeJock.XtremeCommandBars.CommandBarControlButton as shown below:

Public Class MyCommandBarControlButton
   Inherits CodeJock.XtremeCommandBars.CommandBarControlButton

   Public Event Click()

   Public Sub RE()
      RaiseEvent Click()
   End Sub
End Class

I can add the MyCommandBarControlButton and it displays and works fine.  However, in the the CommandBarManager ExecuteCommand event I try to cast the e.control returned back to a MyCommandBarControlButton in order to raise the click event.  When I do the following:

If TypeOf e.Control Is CodeJock.XtremeCommandBars.CommandBarControlButton Then
   Dim MyCB As New MyCommandBarControlButton
   MyCB = CType(e.Control, MyCommandBarControlButton)
   MyCB.RE()
End If

I receive an invalid cast message.  The type of the e.control is a commandbarcontrolbutton so it should work (I use this technique extensively in the treeview control).

If there is a better way to implement individual click events I would appreciate any info!




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net