From: Mr. X. on 19 Mar 2010 06:54 Hello. I want to create a new class (VB 2008). What I did : add new class. and wrote : Public Class MenuButton Inherits Panel .... The code isn't compiled : Error 1 Base class 'System.Windows.Forms.Panel' specified for class 'MenuButton' cannot be different from the base class 'System.Windows.Forms.UserControl' of one of its other partial types. I need little sample code, so I can go on ..., please. Thanks :)
From: Armin Zingler on 19 Mar 2010 07:16 Am 19.03.2010 11:54, schrieb Mr. X.: > Hello. > I want to create a new class (VB 2008). > > What I did : > add new class. > and wrote : > > Public Class MenuButton > Inherits Panel > .... > > The code isn't compiled : > Error 1 Base class 'System.Windows.Forms.Panel' specified for class > 'MenuButton' cannot be different from the base class > 'System.Windows.Forms.UserControl' of one of its other partial types. > > I need little sample code, so I can go on ..., please. > > Thanks :) You've (also) created a UserControl with the name "MenuButton", didn't you? -- Armin
From: Mr. X. on 19 Mar 2010 07:42 Sorry. What I did : add new item - > user control. On the new class/control (menuButton.vb) I wrote : Public Class MenuButton Inherits Panel That's all. Thanks :) "Armin Zingler" <az.nospam(a)freenet.de> wrote in message news:#FE0QX1xKHA.4752(a)TK2MSFTNGP04.phx.gbl... > Am 19.03.2010 11:54, schrieb Mr. X.: >> Hello. >> I want to create a new class (VB 2008). >> >> What I did : >> add new class. >> and wrote : >> >> Public Class MenuButton >> Inherits Panel >> .... >> >> The code isn't compiled : >> Error 1 Base class 'System.Windows.Forms.Panel' specified for class >> 'MenuButton' cannot be different from the base class >> 'System.Windows.Forms.UserControl' of one of its other partial types. >> >> I need little sample code, so I can go on ..., please. >> >> Thanks :) > > You've (also) created a UserControl with the name "MenuButton", didn't > you? > > > -- > Armin
From: Family Tree Mike on 19 Mar 2010 08:31 "Mr. X." wrote: > Sorry. > What I did : add new item - > user control. > On the new class/control (menuButton.vb) I wrote : > Public Class MenuButton > Inherits Panel > > That's all. > > Thanks :) > > "Armin Zingler" <az.nospam(a)freenet.de> wrote in message > news:#FE0QX1xKHA.4752(a)TK2MSFTNGP04.phx.gbl... > > Am 19.03.2010 11:54, schrieb Mr. X.: > >> Hello. > >> I want to create a new class (VB 2008). > >> > >> What I did : > >> add new class. > >> and wrote : > >> > >> Public Class MenuButton > >> Inherits Panel > >> .... > >> > >> The code isn't compiled : > >> Error 1 Base class 'System.Windows.Forms.Panel' specified for class > >> 'MenuButton' cannot be different from the base class > >> 'System.Windows.Forms.UserControl' of one of its other partial types. > >> > >> I need little sample code, so I can go on ..., please. > >> > >> Thanks :) > > > > You've (also) created a UserControl with the name "MenuButton", didn't > > you? > > > > > > -- > > Armin > > . > In the solution explorer, there is a button that says "Show All Files" when you hover over it. Your user control has a second .designer file that is associated with your code file. You changed the inheritance in one file, but not the other, thus the confusion. It is actually a lot easier in the long run to not do what you did. You should just add a class as normal, so you don't get the designer file. Then you don't run into this issue when you add the inherit statement. Mike
From: Armin Zingler on 19 Mar 2010 09:00 Am 19.03.2010 12:42, schrieb Mr. X.: > Sorry. > What I did : add new item - > user control. > On the new class/control (menuButton.vb) I wrote : > Public Class MenuButton > Inherits Panel > > That's all. Do you want to derive your class from Usercontrol or from Panel? If you've created a Usercontrol as you've desribed, you can not inherit from Panel. If you want to inherit from Panel, you must not create a Usercontrol as described. Instead just add a new class (add new item -> class). -- Armin
|
Next
|
Last
Pages: 1 2 3 Prev: Moveable Graphic Object? tutorials Next: Image not getting loaded from My.Resources |