Connecting Tech Pros Worldwide Help | Site Map

Cross-language inheritence question/problem

cranley
Guest
 
Posts: n/a
#1: May 2 '06
Hello again,

Given the following:

A C# written class in .NET 1.1 contained in Assembly A1.dll:

namespace Some.Namespace
{
public class MyBaseForm: System.Windows.Forms.Form
{
public AppointmentDialogBase(MyObject obj1, MyOtherObject obj2, bool
isTrue) : base()
{
// do some stuff
}
}
}

A VB winform, written in .NET 2.0 contained in Assembly B2.dll:

Public Class MySubForm
Inherits Some.Namespace.MyBaseForm

Public Sub New(ByVal obj1 As Some.Namespace.MyObject, _
ByVal obj2 As Some.Namespace.MyOtherObject, ByVal isTrue As
Boolean)

MyBase.New(obj1, obj2, isTrue)

Me.InitializeComponent()
End Sub
End Class

Now, everything compiles fine everywhere, we're all happy happy, and
even at runtime all is well. However, when I go to open MySubForm in
the VS 2005 form designer, I get the following error:

Constructor on type 'Some.Namespace.MyBaseForm' not found.

How is this possible? Everything compile's fine, Intellisense picks
everything up - why can't the form designer figure it out? Does it
have to do with the C# constructor syntax vs. the VB.NET 2.0
constructor syntax?

Any help/guidance would be greatly appreciated.

Thanks in advance.

- ryan.

cranley
Guest
 
Posts: n/a
#2: May 2 '06

re: Cross-language inheritence question/problem


Crap - I proof-read it all and still screwed up the code - the
constructor in my example was wrong, but the problem's still the same:

namespace Some.Namespace
{
public class MyBaseForm: System.Windows.Forms.Form
{
public MyBaseForm(MyObject obj1, MyOtherObject obj2,
bool
isTrue) : base()
{
// do some stuff
}
}

}

A VB winform, written in .NET 2.0 contained in Assembly B2.dll:

Public Class MySubForm
Inherits Some.Namespace.MyBaseForm

Public Sub New(ByVal obj1 As Some.Namespace.MyObject, _
ByVal obj2 As Some.Namespace.MyOtherObject, ByVal isTrue As
Boolean)

MyBase.New(obj1, obj2, isTrue)

Me.InitializeComponent()
End Sub
End Class

Mehdi
Guest
 
Posts: n/a
#3: May 3 '06

re: Cross-language inheritence question/problem


On 2 May 2006 10:16:07 -0700, cranley wrote:
[color=blue]
> namespace Some.Namespace
> {
> public class MyBaseForm: System.Windows.Forms.Form
> {
> public AppointmentDialogBase(MyObject obj1, MyOtherObject obj2, bool
> isTrue) : base()
> {
> // do some stuff
> }
> }
> }[/color]
[...][color=blue]
> Now, everything compiles fine everywhere, we're all happy happy, and
> even at runtime all is well. However, when I go to open MySubForm in
> the VS 2005 form designer, I get the following error:
>
> Constructor on type 'Some.Namespace.MyBaseForm' not found.[/color]

The Visual Studio designer needs a default constructor (that is, a
parameterless constructor) in order to be able to create your form. When
you think about it, it makes sense: how could the designer possibly know
what parameter it should give to your custom constructor? Add a constructor
without any parameters and it should work should fine.
cranley
Guest
 
Posts: n/a
#4: May 3 '06

re: Cross-language inheritence question/problem


Ha! Yea, that was it alright. Pretty obvious oversight on my part...
sometimes you just need that second set of eyes.

Thanks for your help Mehdi, muchly appreciated.

Cheers!

- ryan.

Closed Thread