paulthepaddy
Well-known member
hi, sorry for the name title i really couldn't figure out what would be a reasonable name for this thread :S
the code below is for creating controls at runtiem, but i have realised even tho i remove the controls and then add controls, they are keeping their settings and more so the Data, eg the checked list boxes are keeping their data so if i do some work with 1 of the 3 pannels then when i change the pannel im working on it still has its lists, how would i go about using a 'frest template' as in a clear all previous settings just so their isn't any possable errors.
the code below is for creating controls at runtiem, but i have realised even tho i remove the controls and then add controls, they are keeping their settings and more so the Data, eg the checked list boxes are keeping their data so if i do some work with 1 of the 3 pannels then when i change the pannel im working on it still has its lists, how would i go about using a 'frest template' as in a clear all previous settings just so their isn't any possable errors.
VB.NET:
Public Class CustomPanels
'ZNU = Not Used, Z so it goes ot bottom of list
Inherits Windows.Forms.Panel
Dim ZNU_LTitle As New System.Windows.Forms.Label
Dim ZNU_L1 As New System.Windows.Forms.Label()
Dim ZNU_L2 As New System.Windows.Forms.Label()
Dim ZNU_L3 As New System.Windows.Forms.Label()
Friend WithEvents CheckedListBox1 As New System.Windows.Forms.CheckedListBox()
Friend WithEvents CheckedListBox2 As New System.Windows.Forms.CheckedListBox()
Dim TXT_Input1 As New System.Windows.Forms.TextBox
Dim TXT_Input2 As New System.Windows.Forms.TextBox
Dim TXT_Input3 As New System.Windows.Forms.TextBox
Friend WithEvents BTN_Action1 As New System.Windows.Forms.Button
Friend WithEvents BTN_Action2 As New System.Windows.Forms.Button
Friend WithEvents BTN_Action3 As New System.Windows.Forms.Button
Friend WithEvents BTN_Example As New System.Windows.Forms.Button
#Region "New Damage Area and Subs"
Public Function NewDamageArea() As System.Windows.Forms.Panel
Me.Controls.Clear()
'ZNU_LTitle Settings
Me.ZNU_LTitle.AutoSize = True
Me.ZNU_LTitle.Location = New System.Drawing.Point(9, 12)
Me.ZNU_LTitle.Name = "ZNU_LTitle"
Me.ZNU_LTitle.Size = New System.Drawing.Size(131, 13)
Me.ZNU_LTitle.TabIndex = 0
Me.ZNU_LTitle.Text = "Create New Damage Area"
'ZNU_L1 Settings
Me.ZNU_L1.AutoSize = True
Me.ZNU_L1.Location = New System.Drawing.Point(9, 35)
Me.ZNU_L1.Name = "ZNU_L1"
Me.ZNU_L1.Size = New System.Drawing.Size(213, 13)
Me.ZNU_L1.TabIndex = 0
Me.ZNU_L1.Text = "1) Select Service Damage Area Belongs To"
'ZNU_L2
Me.ZNU_L2.AutoSize = True
Me.ZNU_L2.Location = New System.Drawing.Point(250, 35)
Me.ZNU_L2.Name = "ZNU_L2"
Me.ZNU_L2.Size = New System.Drawing.Size(216, 13)
Me.ZNU_L2.TabIndex = 0
Me.ZNU_L2.Text = "2 ) Select Group(s) Damage Area Applies To"
'ZNU_L3 Settings
Me.ZNU_L3.AutoSize = True
Me.ZNU_L3.Location = New System.Drawing.Point(9, 150)
Me.ZNU_L3.Name = "ZNU_L3"
Me.ZNU_L3.Size = New System.Drawing.Size(224, 13)
Me.ZNU_L3.TabIndex = 0
Me.ZNU_L3.Text = "3 ) Damage Area Name (as shown on invoice)"
'TXT_Input1 Settings
Me.TXT_Input1.Location = New System.Drawing.Point(12, 170)
Me.TXT_Input1.Name = "TXTDamageArea"
Me.TXT_Input1.Size = New System.Drawing.Size(210, 20)
Me.TXT_Input1.TabIndex = 0
'CheckedListBox1
Me.CheckedListBox1.FormattingEnabled = True
Me.CheckedListBox1.Location = New System.Drawing.Point(12, 50)
Me.CheckedListBox1.Name = "CheckedListBox1"
Me.CheckedListBox1.Size = New System.Drawing.Size(213, 94)
Me.CheckedListBox1.TabIndex = 0
'CheckedListBox2
Me.CheckedListBox2.FormattingEnabled = True
Me.CheckedListBox2.Location = New System.Drawing.Point(250, 50)
Me.CheckedListBox2.Name = "CheckedListBox2"
Me.CheckedListBox2.Size = New System.Drawing.Size(216, 94)
Me.CheckedListBox2.TabIndex = 0
'Button1
Me.BTN_Action1.Location = New System.Drawing.Point(250, 170)
Me.BTN_Action1.Name = "BTN_Action"
Me.BTN_Action1.Size = New System.Drawing.Size(150, 23)
Me.BTN_Action1.TabIndex = 0
Me.BTN_Action1.Text = "Add Damage Area"
Me.BTN_Action1.UseVisualStyleBackColor = True
AddHandler BTN_Action1.Click, AddressOf AddDamageArea
'Panel_DamageArea
Me.Controls.Add(Me.ZNU_LTitle)
Me.Controls.Add(Me.ZNU_L1)
Me.Controls.Add(Me.ZNU_L2)
Me.Controls.Add(Me.ZNU_L3)
Me.Controls.Add(Me.TXT_Input1)
Me.Controls.Add(Me.CheckedListBox1)
Me.Controls.Add(Me.CheckedListBox2)
Me.Controls.Add(Me.BTN_Action1)
Me.Location = New System.Drawing.Point(12, 51)
Me.Name = "Panel_DamageArea"
Me.Size = New System.Drawing.Size(487, 308)
Me.TabIndex = 0
Return Me
End Function