Imports System
Imports System.Windows.Forms
Public Class CalendarColumn
Inherits DataGridViewColumn
Public Sub New()
MyBase.New(New CalendarCell())
End Sub
Public Overrides Property CellTemplate() As DataGridViewCell
Get
Return MyBase.CellTemplate
End Get
Set(ByVal value As DataGridViewCell)
' Ensure that the cell used for the template is a CalendarCell.
If (value IsNot Nothing) AndAlso _
Not value.GetType().IsAssignableFrom(GetType(CalendarCell)) _
Then
Throw New InvalidCastException("Must be a CalendarCell")
End If
MyBase.CellTemplate = value
End Set
End Property
End Class
Public Class CalendarCell
Inherits DataGridViewTextBoxCell
Public Sub New()
' Use the short date format.
Me.Style.Format = "d"
End Sub
Public Overrides Sub InitializeEditingControl(ByVal rowIndex As Integer, _
ByVal initialFormattedValue As Object, _
ByVal dataGridViewCellStyle As DataGridViewCellStyle)
' Set the value of the editing control to the current cell value.
MyBase.InitializeEditingControl(rowIndex, initialFormattedValue, _
dataGridViewCellStyle)
Dim ctl As CalendarEditingControl = _
CType(DataGridView.EditingControl, CalendarEditingControl)
ctl.Value = CType(Me.Value, DateTime)
End Sub
Public Overrides ReadOnly Property EditType() As Type
Get
' Return the type of the editing contol that CalendarCell uses.
Return GetType(CalendarEditingControl)
End Get
End Property
Public Overrides ReadOnly Property ValueType() As Type
Get
' Return the type of the value that CalendarCell contains.
Return GetType(DateTime)
End Get
End Property
Public Overrides ReadOnly Property DefaultNewRowValue() As Object
Get
' Use the current date and time as the default value.
Return DateTime.Now
End Get
End Property
End Class
Class CalendarEditingControl
Inherits DateTimePicker
Implements IDataGridViewEditingControl
Private dataGridViewControl As DataGridView
Private valueIsChanged As Boolean = False
Private rowIndexNum As Integer
Public Sub New()
Me.Format = DateTimePickerFormat.Short
End Sub
Public Property EditingControlFormattedValue() As Object _
Implements IDataGridViewEditingControl.EditingControlFormattedValue
Get
Return Me.Value.ToShortDateString()
End Get
Set(ByVal value As Object)
If TypeOf value Is String Then
Me.Value = DateTime.Parse(CStr(value))
End If
End Set
End Property
Public Function GetEditingControlFormattedValue(ByVal context _
As DataGridViewDataErrorContexts) As Object _
Implements IDataGridViewEditingControl.GetEditingControlFormattedValue
Return Me.Value.ToShortDateString()
End Function
Public Sub ApplyCellStyleToEditingControl(ByVal dataGridViewCellStyle As _
DataGridViewCellStyle) _
Implements IDataGridViewEditingControl.ApplyCellStyleToEditingControl
Me.Font = dataGridViewCellStyle.Font
Me.CalendarForeColor = dataGridViewCellStyle.ForeColor
Me.CalendarMonthBackground = dataGridViewCellStyle.BackColor
End Sub
Public Property EditingControlRowIndex() As Integer _
Implements IDataGridViewEditingControl.EditingControlRowIndex
Get
Return rowIndexNum
End Get
Set(ByVal value As Integer)
rowIndexNum = value
End Set
End Property
Public Function EditingControlWantsInputKey(ByVal key As Keys, _
ByVal dataGridViewWantsInputKey As Boolean) As Boolean _
Implements IDataGridViewEditingControl.EditingControlWantsInputKey
' Let the DateTimePicker handle the keys listed.
Select Case key And Keys.KeyCode
Case Keys.Left, Keys.Up, Keys.Down, Keys.Right, _
Keys.Home, Keys.End, Keys.PageDown, Keys.PageUp
Return True
Case Else
Return False
End Select
End Function
Public Sub PrepareEditingControlForEdit(ByVal selectAll As Boolean) _
Implements IDataGridViewEditingControl.PrepareEditingControlForEdit
' No preparation needs to be done.
End Sub
Public ReadOnly Property RepositionEditingControlOnValueChange() _
As Boolean Implements _
IDataGridViewEditingControl.RepositionEditingControlOnValueChange
Get
Return False
End Get
End Property
Public Property EditingControlDataGridView() As DataGridView _
Implements IDataGridViewEditingControl.EditingControlDataGridView
Get
Return dataGridViewControl
End Get
Set(ByVal value As DataGridView)
dataGridViewControl = value
End Set
End Property
Public Property EditingControlValueChanged() As Boolean _
Implements IDataGridViewEditingControl.EditingControlValueChanged
Get
Return valueIsChanged
End Get
Set(ByVal value As Boolean)
valueIsChanged = value
End Set
End Property
Public ReadOnly Property EditingControlCursor() As Cursor _
Implements IDataGridViewEditingControl.EditingPanelCursor
Get
Return MyBase.Cursor
End Get
End Property
Protected Overrides Sub OnValueChanged(ByVal eventargs As EventArgs)
' Notify the DataGridView that the contents of the cell have changed.
valueIsChanged = True
Me.EditingControlDataGridView.NotifyCurrentCellDirty(True)
MyBase.OnValueChanged(eventargs)
End Sub
End Class
Public Class Form1
Inherits Form
Private dataGridView1 As New DataGridView()
_
Public Shared Sub Main()
Application.Run(New Form1())
End Sub
Public Sub New()
Me.dataGridView1.Dock = DockStyle.Fill
Me.Controls.Add(Me.dataGridView1)
Me.Text = "DataGridView calendar column demo"
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles Me.Load
Dim col As New CalendarColumn()
Me.dataGridView1.Columns.Add(col)
Me.dataGridView1.RowCount = 5
Dim row As DataGridViewRow
For Each row In Me.dataGridView1.Rows
row.Cells(0).Value = DateTime.Now
Next row
End Sub
End Class
Monday, December 17, 2007
DateTimePicker on DatagridView
Sunday, October 14, 2007
File Handling with StreamReader and StreamWriter using Dialogs!

This is the code:
----------------
'
'
'Sequence 1 Task 11 open file special isntruction
Private Sub Buttons1t11importsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttons1t11importsi.Click
Try
OpenFileDialogs1t11.Filter = "Rich Text Files(*.rtf)|*.rtf|MS Documents(*.doc)|*.doc|" & _
"All files(*.*)|*.*"
If OpenFileDialogs1t11.ShowDialog = Windows.Forms.DialogResult.OK Then
OpenFileDialogs1t11.ShowHelp = True
Dim fs As New FileStream(OpenFileDialogs1t11.FileName, FileMode.Open)
Dim sr As New StreamReader(fs)
RichTextBoxs1t11si.Rtf = sr.ReadToEnd()
sr.Close()
fs.Close()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
'
'
'Sequence 1 Task 11 save file special instruction
Private Sub Buttons1t11editsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttons1t11editsi.Click
Try
SaveFileDialogs1t11.Filter = "Rich Text Files(*.rtf)|*.rtf|MS Documents(*.doc)|*.doc|" & _ "All files(*.*)|*.*"
If SaveFileDialogs1t11.ShowDialog = Windows.Forms.DialogResult.OK Then
SaveFileDialogs1t11.ShowHelp = True
Dim fs As New FileStream(SaveFileDialogs1t11.FileName, FileMode.OpenOrCreate)
Dim sw As New StreamWriter(fs)
sw.Write(RichTextBoxs1t11si.Rtf)
sw.Close()
fs.Close()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
'
'
'Sequence 1 Task 11 format
Private Sub Buttons1t11format_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttons1t11format.Click
Try
If FontDialogs1t1.ShowDialog = Windows.Forms.DialogResult.OK Then
FontDialogs1t1.ShowHelp = True
'for work instruction
RichTextBoxs1t11wi.SelectionFont = FontDialogs1t1.Font
RichTextBoxs1t11wi.SelectionColor = FontDialogs1t1.Color
'for special instruction
RichTextBoxs1t11si.SelectionFont = FontDialogs1t1.Font
RichTextBoxs1t11si.SelectionColor = FontDialogs1t1.Color
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Friday, September 21, 2007
VB.NET's Displaying total number in Checkbox.
This post discussed on how to display the total task when a checkbox control is checked.

This is the code:
----------------
Imports System.Windows.Forms.CheckBox
Imports MySql.Data.MySqlClient
Imports System.IO
Public Class Production_Sequence
Dim totaltask As Integer = 0
Dim Production_Sequence() As Integer = {13, 2, 2, 2, 2, 3, 4, 5, 2, 2, 2, 2, 3, 9, 4, _
2, 1, 4, 13, 10, 5, 4, 4, 1, 3, 3, 3, 1, 1, 5, 1, 3, 4, 4, 1, 2, 1}
Dim checkbox() As CheckBox = New CheckBox() {CheckBoxProductionSequence1, CheckBoxProductionSequence2, CheckBoxProductionSequence2_1, _
CheckBoxProductionSequence3, CheckBoxProductionSequence4, CheckBoxProductionSequence4_1, CheckBoxProductionSequence5, CheckBoxProductionSequence6, _
CheckBoxProductionSequence7, CheckBoxProductionSequence8, CheckBoxProductionSequence9, CheckBoxProductionSequence10, CheckBoxProductionSequence11, _
CheckBoxProductionSequence12, CheckBoxProductionSequence13, CheckBoxProductionSequence14, CheckBoxProductionSequence15, CheckBoxProductionSequence16, _
CheckBoxProductionSequence17, CheckBoxProductionSequence18, CheckBoxProductionSequence19, CheckBoxProductionSequence20, CheckBoxProductionSequence21, _
CheckBoxProductionSequence22, CheckBoxProductionSequence23, CheckBoxProductionSequence24, CheckBoxProductionSequence25, CheckBoxProductionSequence26, _
CheckBoxProductionSequence27, CheckBoxProductionSequence28, CheckBoxProductionSequence29, CheckBoxProductionSequence30, CheckBoxProductionSequence31, _
CheckBoxProductionSequence32, CheckBoxProductionSequence33, CheckBoxProductionSequence34, CheckBoxProductionSequence35}
Public Function TotalProductionTask(ByVal x) As Short
Try
If checkbox(x).Checked = True Then
totaltask = totaltask + Production_Sequence(x)
Else
totaltask = totaltask - Production_Sequence(x)
End If
TotalProductionTask = totaltask
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
Private Sub CheckBoxProductionSequence1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence1.CheckedChanged
Try
checkbox(0) = CheckBoxProductionSequence1
TextBoxTotalTask.Text = TotalProductionTask(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence2.CheckedChanged
Try
checkbox(1) = CheckBoxProductionSequence2
TextBoxTotalTask.Text = TotalProductionTask(1)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence2_1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence2_1.CheckedChanged
Try
checkbox(2) = CheckBoxProductionSequence2_1
TextBoxTotalTask.Text = TotalProductionTask(2)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence3.CheckedChanged
Try
checkbox(3) = CheckBoxProductionSequence3
TextBoxTotalTask.Text = TotalProductionTask(3)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence4.CheckedChanged
Try
checkbox(4) = CheckBoxProductionSequence4
TextBoxTotalTask.Text = TotalProductionTask(4)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence4_1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence4_1.CheckedChanged
Try
checkbox(5) = CheckBoxProductionSequence4_1
TextBoxTotalTask.Text = TotalProductionTask(5)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence5.CheckedChanged
Try
checkbox(6) = CheckBoxProductionSequence5
TextBoxTotalTask.Text = TotalProductionTask(6)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence6.CheckedChanged
Try
checkbox(7) = CheckBoxProductionSequence6
TextBoxTotalTask.Text = TotalProductionTask(7)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence7.CheckedChanged
Try
checkbox(8) = CheckBoxProductionSequence7
TextBoxTotalTask.Text = TotalProductionTask(8)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence8.CheckedChanged
Try
checkbox(9) = CheckBoxProductionSequence8
TextBoxTotalTask.Text = TotalProductionTask(9)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence9.CheckedChanged
Try
checkbox(10) = CheckBoxProductionSequence9
TextBoxTotalTask.Text = TotalProductionTask(10)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence10.CheckedChanged
Try
checkbox(11) = CheckBoxProductionSequence10
TextBoxTotalTask.Text = TotalProductionTask(11)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence11_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence11.CheckedChanged
Try
checkbox(12) = CheckBoxProductionSequence11
TextBoxTotalTask.Text = TotalProductionTask(12)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence12.CheckedChanged
Try
checkbox(13) = CheckBoxProductionSequence12
TextBoxTotalTask.Text = TotalProductionTask(13)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence13_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence13.CheckedChanged
Try
checkbox(14) = CheckBoxProductionSequence13
TextBoxTotalTask.Text = TotalProductionTask(14)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence14_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence14.CheckedChanged
Try
checkbox(15) = CheckBoxProductionSequence14
TextBoxTotalTask.Text = TotalProductionTask(15)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence15_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence15.CheckedChanged
Try
checkbox(16) = CheckBoxProductionSequence15
TextBoxTotalTask.Text = TotalProductionTask(16)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence16_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence16.CheckedChanged
Try
checkbox(17) = CheckBoxProductionSequence16
TextBoxTotalTask.Text = TotalProductionTask(17)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence17_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence17.CheckedChanged
Try
checkbox(18) = CheckBoxProductionSequence17
TextBoxTotalTask.Text = TotalProductionTask(18)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence18_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence18.CheckedChanged
Try
checkbox(19) = CheckBoxProductionSequence18
TextBoxTotalTask.Text = TotalProductionTask(19)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence19_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence19.CheckedChanged
Try
checkbox(20) = CheckBoxProductionSequence19
TextBoxTotalTask.Text = TotalProductionTask(20)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence20_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence20.CheckedChanged
Try
checkbox(21) = CheckBoxProductionSequence20
TextBoxTotalTask.Text = TotalProductionTask(21)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence21_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence21.CheckedChanged
Try
checkbox(22) = CheckBoxProductionSequence21
TextBoxTotalTask.Text = TotalProductionTask(22)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence22_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence22.CheckedChanged
Try
checkbox(23) = CheckBoxProductionSequence22
TextBoxTotalTask.Text = TotalProductionTask(23)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence23_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence23.CheckedChanged
Try
checkbox(24) = CheckBoxProductionSequence23
TextBoxTotalTask.Text = TotalProductionTask(24)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence24_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence24.CheckedChanged
Try
checkbox(25) = CheckBoxProductionSequence24
TextBoxTotalTask.Text = TotalProductionTask(25)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence25_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence25.CheckedChanged
Try
checkbox(26) = CheckBoxProductionSequence25
TextBoxTotalTask.Text = TotalProductionTask(26)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence26_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence26.CheckedChanged
Try
checkbox(27) = CheckBoxProductionSequence26
TextBoxTotalTask.Text = TotalProductionTask(27)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence27_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence27.CheckedChanged
Try
checkbox(28) = CheckBoxProductionSequence27
TextBoxTotalTask.Text = TotalProductionTask(28)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence28_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence28.CheckedChanged
Try
checkbox(29) = CheckBoxProductionSequence28
TextBoxTotalTask.Text = TotalProductionTask(29)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence29_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence29.CheckedChanged
Try
checkbox(30) = CheckBoxProductionSequence29
TextBoxTotalTask.Text = TotalProductionTask(30)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence30_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence30.CheckedChanged
Try
checkbox(31) = CheckBoxProductionSequence30
TextBoxTotalTask.Text = TotalProductionTask(31)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence31_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence31.CheckedChanged
Try
checkbox(32) = CheckBoxProductionSequence31
TextBoxTotalTask.Text = TotalProductionTask(32)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence32_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence32.CheckedChanged
Try
checkbox(33) = CheckBoxProductionSequence32
TextBoxTotalTask.Text = TotalProductionTask(33)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence33_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence33.CheckedChanged
Try
checkbox(34) = CheckBoxProductionSequence33
TextBoxTotalTask.Text = TotalProductionTask(34)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence34_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence34.CheckedChanged
Try
checkbox(35) = CheckBoxProductionSequence34
TextBoxTotalTask.Text = TotalProductionTask(35)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence35_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence35.CheckedChanged
Try
checkbox(36) = CheckBoxProductionSequence35
TextBoxTotalTask.Text = TotalProductionTask(36)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
This is the code:
----------------
Imports System.Windows.Forms.CheckBox
Imports MySql.Data.MySqlClient
Imports System.IO
Public Class Production_Sequence
Dim totaltask As Integer = 0
Dim Production_Sequence() As Integer = {13, 2, 2, 2, 2, 3, 4, 5, 2, 2, 2, 2, 3, 9, 4, _
2, 1, 4, 13, 10, 5, 4, 4, 1, 3, 3, 3, 1, 1, 5, 1, 3, 4, 4, 1, 2, 1}
Dim checkbox() As CheckBox = New CheckBox() {CheckBoxProductionSequence1, CheckBoxProductionSequence2, CheckBoxProductionSequence2_1, _
CheckBoxProductionSequence3, CheckBoxProductionSequence4, CheckBoxProductionSequence4_1, CheckBoxProductionSequence5, CheckBoxProductionSequence6, _
CheckBoxProductionSequence7, CheckBoxProductionSequence8, CheckBoxProductionSequence9, CheckBoxProductionSequence10, CheckBoxProductionSequence11, _
CheckBoxProductionSequence12, CheckBoxProductionSequence13, CheckBoxProductionSequence14, CheckBoxProductionSequence15, CheckBoxProductionSequence16, _
CheckBoxProductionSequence17, CheckBoxProductionSequence18, CheckBoxProductionSequence19, CheckBoxProductionSequence20, CheckBoxProductionSequence21, _
CheckBoxProductionSequence22, CheckBoxProductionSequence23, CheckBoxProductionSequence24, CheckBoxProductionSequence25, CheckBoxProductionSequence26, _
CheckBoxProductionSequence27, CheckBoxProductionSequence28, CheckBoxProductionSequence29, CheckBoxProductionSequence30, CheckBoxProductionSequence31, _
CheckBoxProductionSequence32, CheckBoxProductionSequence33, CheckBoxProductionSequence34, CheckBoxProductionSequence35}
Public Function TotalProductionTask(ByVal x) As Short
Try
If checkbox(x).Checked = True Then
totaltask = totaltask + Production_Sequence(x)
Else
totaltask = totaltask - Production_Sequence(x)
End If
TotalProductionTask = totaltask
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
Private Sub CheckBoxProductionSequence1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence1.CheckedChanged
Try
checkbox(0) = CheckBoxProductionSequence1
TextBoxTotalTask.Text = TotalProductionTask(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence2.CheckedChanged
Try
checkbox(1) = CheckBoxProductionSequence2
TextBoxTotalTask.Text = TotalProductionTask(1)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence2_1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence2_1.CheckedChanged
Try
checkbox(2) = CheckBoxProductionSequence2_1
TextBoxTotalTask.Text = TotalProductionTask(2)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence3.CheckedChanged
Try
checkbox(3) = CheckBoxProductionSequence3
TextBoxTotalTask.Text = TotalProductionTask(3)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence4.CheckedChanged
Try
checkbox(4) = CheckBoxProductionSequence4
TextBoxTotalTask.Text = TotalProductionTask(4)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence4_1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence4_1.CheckedChanged
Try
checkbox(5) = CheckBoxProductionSequence4_1
TextBoxTotalTask.Text = TotalProductionTask(5)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence5.CheckedChanged
Try
checkbox(6) = CheckBoxProductionSequence5
TextBoxTotalTask.Text = TotalProductionTask(6)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence6.CheckedChanged
Try
checkbox(7) = CheckBoxProductionSequence6
TextBoxTotalTask.Text = TotalProductionTask(7)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence7.CheckedChanged
Try
checkbox(8) = CheckBoxProductionSequence7
TextBoxTotalTask.Text = TotalProductionTask(8)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence8.CheckedChanged
Try
checkbox(9) = CheckBoxProductionSequence8
TextBoxTotalTask.Text = TotalProductionTask(9)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence9.CheckedChanged
Try
checkbox(10) = CheckBoxProductionSequence9
TextBoxTotalTask.Text = TotalProductionTask(10)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence10.CheckedChanged
Try
checkbox(11) = CheckBoxProductionSequence10
TextBoxTotalTask.Text = TotalProductionTask(11)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence11_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence11.CheckedChanged
Try
checkbox(12) = CheckBoxProductionSequence11
TextBoxTotalTask.Text = TotalProductionTask(12)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence12.CheckedChanged
Try
checkbox(13) = CheckBoxProductionSequence12
TextBoxTotalTask.Text = TotalProductionTask(13)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence13_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence13.CheckedChanged
Try
checkbox(14) = CheckBoxProductionSequence13
TextBoxTotalTask.Text = TotalProductionTask(14)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence14_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence14.CheckedChanged
Try
checkbox(15) = CheckBoxProductionSequence14
TextBoxTotalTask.Text = TotalProductionTask(15)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence15_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence15.CheckedChanged
Try
checkbox(16) = CheckBoxProductionSequence15
TextBoxTotalTask.Text = TotalProductionTask(16)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence16_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence16.CheckedChanged
Try
checkbox(17) = CheckBoxProductionSequence16
TextBoxTotalTask.Text = TotalProductionTask(17)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence17_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence17.CheckedChanged
Try
checkbox(18) = CheckBoxProductionSequence17
TextBoxTotalTask.Text = TotalProductionTask(18)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence18_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence18.CheckedChanged
Try
checkbox(19) = CheckBoxProductionSequence18
TextBoxTotalTask.Text = TotalProductionTask(19)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence19_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence19.CheckedChanged
Try
checkbox(20) = CheckBoxProductionSequence19
TextBoxTotalTask.Text = TotalProductionTask(20)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence20_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence20.CheckedChanged
Try
checkbox(21) = CheckBoxProductionSequence20
TextBoxTotalTask.Text = TotalProductionTask(21)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence21_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence21.CheckedChanged
Try
checkbox(22) = CheckBoxProductionSequence21
TextBoxTotalTask.Text = TotalProductionTask(22)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence22_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence22.CheckedChanged
Try
checkbox(23) = CheckBoxProductionSequence22
TextBoxTotalTask.Text = TotalProductionTask(23)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence23_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence23.CheckedChanged
Try
checkbox(24) = CheckBoxProductionSequence23
TextBoxTotalTask.Text = TotalProductionTask(24)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence24_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence24.CheckedChanged
Try
checkbox(25) = CheckBoxProductionSequence24
TextBoxTotalTask.Text = TotalProductionTask(25)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence25_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence25.CheckedChanged
Try
checkbox(26) = CheckBoxProductionSequence25
TextBoxTotalTask.Text = TotalProductionTask(26)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence26_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence26.CheckedChanged
Try
checkbox(27) = CheckBoxProductionSequence26
TextBoxTotalTask.Text = TotalProductionTask(27)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence27_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence27.CheckedChanged
Try
checkbox(28) = CheckBoxProductionSequence27
TextBoxTotalTask.Text = TotalProductionTask(28)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence28_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence28.CheckedChanged
Try
checkbox(29) = CheckBoxProductionSequence28
TextBoxTotalTask.Text = TotalProductionTask(29)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence29_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence29.CheckedChanged
Try
checkbox(30) = CheckBoxProductionSequence29
TextBoxTotalTask.Text = TotalProductionTask(30)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence30_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence30.CheckedChanged
Try
checkbox(31) = CheckBoxProductionSequence30
TextBoxTotalTask.Text = TotalProductionTask(31)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence31_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence31.CheckedChanged
Try
checkbox(32) = CheckBoxProductionSequence31
TextBoxTotalTask.Text = TotalProductionTask(32)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence32_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence32.CheckedChanged
Try
checkbox(33) = CheckBoxProductionSequence32
TextBoxTotalTask.Text = TotalProductionTask(33)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence33_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence33.CheckedChanged
Try
checkbox(34) = CheckBoxProductionSequence33
TextBoxTotalTask.Text = TotalProductionTask(34)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence34_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence34.CheckedChanged
Try
checkbox(35) = CheckBoxProductionSequence34
TextBoxTotalTask.Text = TotalProductionTask(35)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub CheckBoxProductionSequence35_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxProductionSequence35.CheckedChanged
Try
checkbox(36) = CheckBoxProductionSequence35
TextBoxTotalTask.Text = TotalProductionTask(36)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Thursday, August 30, 2007
Data Providers of .NET Framework
- SQL Server: Namespace(Imports System.Data.SqlClient)
- OLE DB: Namespace(Imports System.Data.OLEDB)
- MySQL: Namespace(Imports System.Data.MySqlClient)
- Oracle: Namespace(Imports Oracle.DataAccess.Client)
- Oracle: Namespae(Imports System.Data.OracleClient)
- MaxDB: Namespace(Imports MaxDB.Data)
- ODBC: Namespace(Imports System.Data.Odbc)
- You have to add reference before you can import.
Monday, June 11, 2007
Surrogate Technologies Predating IPv6 excluding IPv4
- VLSM - Variable Length Subnet Masking
- CIDR - Classless InterDomain Routing
- Supernetting -
- NAT - Network Address Translation
Saturday, June 9, 2007
Case Studies (Software and Web Development)
Studies include:
Case Study 1:
In this blog http://ian-mars.blogspot.com - complete / finish the 1) IPv4 subnet calculator using javascript and html the technologies supported in this blogsite.
Case Study 2:
Make your personal http sites a 1) web 2.0 compliant web site and 2) dynamic with 3) database connectivity for the collection of data like your books, codes, et al... And implement a 4) web robots on your site, 5) A shopping cart for Ecommerce, 6) and implement a built in search. Then test it using the web 2.0 validator and w3c validator to test if it conforms to the standards defined by the standardization body.
- Web
- Desktop Application
- Distributed Systems
- Embedded Systems
- Microcontroller/Microprocessor
- Mobile Systems
- Operating Systems
- RDBMS and Non-RDBMS
- Business Application
- et al...
Case Study 1:
In this blog http://ian-mars.blogspot.com - complete / finish the 1) IPv4 subnet calculator using javascript and html the technologies supported in this blogsite.
Case Study 2:
Make your personal http sites a 1) web 2.0 compliant web site and 2) dynamic with 3) database connectivity for the collection of data like your books, codes, et al... And implement a 4) web robots on your site, 5) A shopping cart for Ecommerce, 6) and implement a built in search. Then test it using the web 2.0 validator and w3c validator to test if it conforms to the standards defined by the standardization body.
Monday, June 4, 2007
Subscribe to:
Posts (Atom)



