Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Error converting type...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Error converting type...

 Post Reply Post Reply
Author
Message
random0000 View Drop Down
Newbie
Newbie


Joined: 22 October 2003
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote random0000 Quote  Post ReplyReply Direct Link To This Post Topic: Error converting type...
    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!

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.