Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Private checkboxCount As Integer
Private k As Integer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Friend WithEvents TabPage2 As System.Windows.Forms.TabPage
Friend WithEvents CheckedListBox1 As System.Windows.Forms.CheckedListBox
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents DataSet1 As System.Data.DataSet
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.TabControl1 = New System.Windows.Forms.TabControl
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.CheckBox1 = New System.Windows.Forms.CheckBox
Me.TabPage2 = New System.Windows.Forms.TabPage
Me.CheckedListBox1 = New System.Windows.Forms.CheckedListBox
Me.DataSet1 = New System.Data.DataSet
Me.TabControl1.SuspendLayout()
Me.TabPage1.SuspendLayout()
Me.TabPage2.SuspendLayout()
CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'TabControl1
'
Me.TabControl1.Controls.Add(Me.TabPage1)
Me.TabControl1.Controls.Add(Me.TabPage2)
Me.TabControl1.Location = New System.Drawing.Point(8, 24)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(272, 216)
Me.TabControl1.TabIndex = 1
'
'TabPage1
'
Me.TabPage1.Controls.Add(Me.CheckBox1)
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(264, 190)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "TabPage1"
'
'CheckBox1
'
Me.CheckBox1.Location = New System.Drawing.Point(8, 24)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(96, 24)
Me.CheckBox1.TabIndex = 0
Me.CheckBox1.Text = "CheckBox1"
'
'TabPage2
'
Me.TabPage2.Controls.Add(Me.CheckedListBox1)
Me.TabPage2.Location = New System.Drawing.Point(4, 22)
Me.TabPage2.Name = "TabPage2"
Me.TabPage2.Size = New System.Drawing.Size(264, 190)
Me.TabPage2.TabIndex = 1
Me.TabPage2.Text = "TabPage2"
'
'CheckedListBox1
'
Me.CheckedListBox1.Location = New System.Drawing.Point(8, 8)
Me.CheckedListBox1.Name = "CheckedListBox1"
Me.CheckedListBox1.Size = New System.Drawing.Size(136, 34)
Me.CheckedListBox1.TabIndex = 0
'
'DataSet1
'
Me.DataSet1.DataSetName = "NewDataSet"
Me.DataSet1.Locale = New System.Globalization.CultureInfo("en-US")
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.TabControl1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.TabControl1.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
Me.TabPage2.ResumeLayout(False)
CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim Array1() As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DataSet1.Tables.Add()
DataSet1.Tables(0).Columns.Add("Time")
Dim times As String() = {TimeOfDay}
Dim times1 As String() = {TimeOfDay}
DataSet1.Tables(0).Rows.Add(times)
DataSet1.Tables(0).Rows.Add(times1)
CheckedListBox1.DataSource = DataSet1.Tables(0)
CheckedListBox1.DisplayMember = "Time"
checkboxCount = CheckedListBox1.Items.Count()
End Sub
Private Sub CheckedListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckedListBox1.SelectedIndexChanged
ReDim Array1(checkboxCount - 1)
Dim i As Integer
For i = 0 To Array1.Length - 1
Dim j As Boolean = CheckedListBox1.GetItemChecked(i)
Array1(i) = j.ToString
Next
End Sub
Private Sub TabControl1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.Click
For k = 0 To Array1.Length - 1
CheckedListBox1.SetItemChecked(k, Array1(k))
Next
End Sub
End Class