HELP Vb.NET Cannot Inherit from System.ComponentModel.Design.CollectionEditor.CollectionForm
-
Hi, does anyone out there know how to create a new class that inherits form System.ComponentModel.Design.CollectionEditor.CollectionForm? I've checked online and it seems that this can be done in C#, but I can't find any resources out there that explain how to inherit this class in vb.net. Thank you in advance. C#: public class MyCollectionEditor : CollectionEditor { protected class MyCollectionForm : CollecitonEditor.CollectionForm { } } VB.Net - Does not work, error msg: "System.ComponentModel.Design.collectioneditor.collectionform is not accessible in this context because it is 'Protected'" public class MyCollectionEditor inherits CollectionEditor protected class MyCollectionForm inherits CollecitonEditor.CollectionForm end class end class eatwork
-
Hi, does anyone out there know how to create a new class that inherits form System.ComponentModel.Design.CollectionEditor.CollectionForm? I've checked online and it seems that this can be done in C#, but I can't find any resources out there that explain how to inherit this class in vb.net. Thank you in advance. C#: public class MyCollectionEditor : CollectionEditor { protected class MyCollectionForm : CollecitonEditor.CollectionForm { } } VB.Net - Does not work, error msg: "System.ComponentModel.Design.collectioneditor.collectionform is not accessible in this context because it is 'Protected'" public class MyCollectionEditor inherits CollectionEditor protected class MyCollectionForm inherits CollecitonEditor.CollectionForm end class end class eatwork
You can start with this:
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.ComponentModel.Design ' Important!!
Imports System.Windows.Forms ' Important!!
Public Class MyCollectionEditor
Inherits CollectionEditor
Public Sub New(ByVal type As Type)
MyBase.New(type)
End Sub
.
.
.
Private Class MyCollectionEditorForm
Inherits CollectionForm
Public Sub New(ByVal editor As CollectionEditor)
MyBase.New(editor)
.
. ' setup other form properties...
.
End Sub
Public Sub New(ByVal type As Type)
MyBase.New(type)
End SubProtected Overrides Function CreateCollectionForm() As CollectionForm Return New MyCollectionEditorForm(Me) End Function End Class
End Class
I strongly suggest picking up Lutz Roeder's .NET Reflector and examine some existing collection editors before continuing. Also, I'd keep the MSDN documentation for CollectionBase, CollectionEditor, and CollectionEditor.CollectionForm bookmarked. Keep in mind, that CollectionForm is just a normal Windows Forms Form. I wonder what you can do with that little tidbit... Dave Kreskowiak Microsoft MVP - Visual Basic
-
You can start with this:
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.ComponentModel.Design ' Important!!
Imports System.Windows.Forms ' Important!!
Public Class MyCollectionEditor
Inherits CollectionEditor
Public Sub New(ByVal type As Type)
MyBase.New(type)
End Sub
.
.
.
Private Class MyCollectionEditorForm
Inherits CollectionForm
Public Sub New(ByVal editor As CollectionEditor)
MyBase.New(editor)
.
. ' setup other form properties...
.
End Sub
Public Sub New(ByVal type As Type)
MyBase.New(type)
End SubProtected Overrides Function CreateCollectionForm() As CollectionForm Return New MyCollectionEditorForm(Me) End Function End Class
End Class
I strongly suggest picking up Lutz Roeder's .NET Reflector and examine some existing collection editors before continuing. Also, I'd keep the MSDN documentation for CollectionBase, CollectionEditor, and CollectionEditor.CollectionForm bookmarked. Keep in mind, that CollectionForm is just a normal Windows Forms Form. I wonder what you can do with that little tidbit... Dave Kreskowiak Microsoft MVP - Visual Basic
Hello Dave, Thank you for your reply, I will check out Lutz Roeders .NET reflector, and it seems as though all of the other collection editors available online are done through C#. But, I will continue the search online. I tried your starter code, but I still have the same problem. Visual Studio 2003 does not recognize: Private Class MyCollectionEditorForm Inherits CollectionForm because it says that it is protected. I was also not able to load the System.Collections.Generic library. Any ideas on why this is happening? is it because I don't have the generic library imported? Thanks eatwork
-
Hello Dave, Thank you for your reply, I will check out Lutz Roeders .NET reflector, and it seems as though all of the other collection editors available online are done through C#. But, I will continue the search online. I tried your starter code, but I still have the same problem. Visual Studio 2003 does not recognize: Private Class MyCollectionEditorForm Inherits CollectionForm because it says that it is protected. I was also not able to load the System.Collections.Generic library. Any ideas on why this is happening? is it because I don't have the generic library imported? Thanks eatwork
That's beause I'm using 2005, not 2003. They may have changed the CollectionForm protection between .NET 1.x and 2.0. There is, also, no System.Collections.Generic namespace in .NET 1.x, so you don't have to include it. Dave Kreskowiak Microsoft MVP - Visual Basic
-
That's beause I'm using 2005, not 2003. They may have changed the CollectionForm protection between .NET 1.x and 2.0. There is, also, no System.Collections.Generic namespace in .NET 1.x, so you don't have to include it. Dave Kreskowiak Microsoft MVP - Visual Basic