SP1 Upgrade- no longer accepts winPart

SP1 Upgrade- no longer accepts winPart

Old forum URL: forums.lhotka.net/forums/t/2501.aspx


Lazor posted on Saturday, March 10, 2007

After upgrading to Service Pack 1  (SP1) for Visual Studio, now when I create a user control and add
Inherits WinPart, I get this error:

Bass class 'WinPart" specified for class 'UserControl2'
cannot be different from the base class
'System.Windows.Forms.UserControl' of one of its other
partial types

Change class 'UserControl2' to inherit from
'WindowsApplication1.WinPart'.

Change class 'UserControl2' to inherit from
'System.Windows'Forms.UserControl'.

Neither corrects.  I downloaded the latest version as of 3/9/2007 - still no help.
How do I fix it?

RockfordLhotka replied on Saturday, March 10, 2007

I am running SP1, and I just successfully added a usercontrol to ProjectTracker, and then changed it so it inherits from WinPart. This worked fine, so I am guessing you have some other issue with your UI code.

Lazor replied on Saturday, March 10, 2007

Hmmmmm...Thanks for the help.  However, I also added a user control to Project tracker and after adding "Inherits WinPart" still got the same error.   Any ideas?

RockfordLhotka replied on Saturday, March 10, 2007

If you are using C#, make sure you’ve built the solution. The lack of a background compiler means that some things don’t work until after you build.

 

Rocky

 

From: Lazor [mailto:cslanet@lhotka.net]
Sent: Saturday, March 10, 2007 11:46 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] SP1 Upgrade- no longer accepts winPart

 

Hmmmmm...Thanks for the help.  However, I also added a user control to Project tracker and after adding "Inherits WinPart" still got the same error.   Any ideas?


xal replied on Saturday, March 10, 2007

You say "after adding Inherits WinPart"... Did you change the inherits line in the designer's partial class or just added that in the standard class?

Sounds like the same class has 2 inherits lines in 2 different partial classes.
You can also avoid this issues by choosing add -> Component in your project and then choose "inherited user control". That'll show you a list of available user controls to inherit from.

Andrés

Lazor replied on Monday, March 12, 2007

I recompiled but the problem presists.  However I tried adding the component and that worked fine.  I'm still puzzled - I just added a user control to the PTWin project, and added the inherits WinPart.  However since the adding component worked - I won't lose sleep.  Thanks guys for the help.

xal replied on Monday, March 12, 2007

Ok, I think you missed the partial class thing. Notice how when you open up the code for the usercontrol, you just get the class definition and nothing else? It doesn't even say "Inherits UserControl". That's because there's a second partial class that's hidden by default that contains all the designer generated code and the "inherits" line. You need to toogle "Show all files" on (second button in solution explorer's toolbar) and you'll be able to expand the user control. Open the ".Designer.vb" file and you'll be able to see that....

I hope that solves your issue!

Andrés

Copyright (c) Marimer LLC