Link to home
Start Free TrialLog in
Avatar of hc_gupta
hc_gupta

asked on

How to change type of UserControl to ContextMenuStrip?

Sir,

How to change System.Windows.Forms.UserControl to System.Windows.Forms.ContextMenuStrip?

Thanks in advance
Avatar of FamousMortimer
FamousMortimer
Flag of United States of America image

Not sure exactly what you mean, but you can convert an object to a contextmenustrip like so...

Dim cms As System.Windows.Forms.ContextMenuStrip = CType(MyUserControl, System.Windows.Forms.ContextMenuStrip)

Open in new window

Avatar of hc_gupta
hc_gupta

ASKER

My user control name is UserControlCMS1 and on using above line i.e.

Dim cms As System.Windows.Forms.ContextMenuStrip = CType(UserControlCMS1, System.Windows.Forms.ContextMenuStrip)

I'm getting an error :

" Value of type UserControlCMS can not be converted to 'System.Windows.ContextMenuStrip' "
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial