No, it is not needed. You can see MSDN samples for basic Custom Controls, like : How to: Develop a Simple Windows Forms Control
Is components as Container needed for all custom controls?
Peter Volz
1,295
Reputation points
Hello, I'm learning designing of .net framework WinForms controls In a custom control I've seen:
Private components As System.ComponentModel.IContainer
and:
Protected Overrides Sub Dispose(ByVal Disposing As Boolean)
Try
If Disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(Disposing)
End Try
End Sub
also in Private Sub InitializeComponent() :
Me.components = New System.ComponentModel.Container()
But this custom control has an ImageList component When designing my own custom control, which does not have any component (such as Image List) should I still insert the above code to my custom control? My custom control inherits the Panel with 1 Button and 1 TextBox inside, nothing more.
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,560 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,892 questions