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=225
Printed Date: 23 November 2024 at 10:35am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Error converting type...
Posted By: random0000
Subject: Error converting type...
Date Posted: 12 November 2003 at 2:35am

I am trying to implement a plugin system using you 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!




Replies:
Posted By: random0000
Date Posted: 02 December 2003 at 12:14pm
Hello? Any ideas?



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