Cross-language inheritence question/problem

C

cranley

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.
 
C

cranley

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
 
M

Mehdi

namespace Some.Namespace
{
public class MyBaseForm: System.Windows.Forms.Form
{
public AppointmentDialogBase(MyObject obj1, MyOtherObject obj2, bool
isTrue) : base()
{
// do some stuff
}
}
} [...]
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.

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.
 
C

cranley

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.
 
Top