I declared the BindingSource inside the form designer, when I run the form without any other controls the CPU memory is more than normal one. For example, if I run the form without declaring the BindingSource object, it takes less than 10% of CPU memory. But after declaring and initalizing the binding source like below, when run the form it takes more than 15% of CPU memory. How can I properly using the SindingSource
The code for initializing the BindingSource,
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Me.ClassfileBindingSource = New System.Windows.Forms.BindingSource(Me.components) CType(Me.ClassfileBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'ClassfileBindingSource ' Me.ClassfileBindingSource.DataSource = GetType(WindowsApplication2.Classfile) ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(631, 437) Me.Name = "Form1" Me.Text = "Form1" CType(Me.ClassfileBindingSource, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub Friend WithEvents ClassfileBindingSource As System.Windows.Forms.BindingSource End Class
And the code for the binding class is below,
Public Class Classfile Private id As Integer Private name As String Public Property ID1 Get Return Me.id End Get Set(value) Me.id = value End Set End Property Public Property Name1 Get Return Me.name End Get Set(value) Me.name = value End Set End Property End Class