Hi Bart,
Maybe you could post the entire code that reproduces this problem ?
Here is the entire code necessary to reproduce the problem. (It is
simplified to contain only the code necessary)
1.) Form Code
2.) Data Tables (SQL)
3.) Sample Data
4.) Data set code
5.) Data access code
6.) Stored Procedures
======================
1.) Form Code
\\
Public Class f010Jobs
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
'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 labUserNote As System.Windows.Forms.Label
Friend WithEvents txtJobDescription As System.Windows.Forms.TextBox
Friend WithEvents labJobDescription As System.Windows.Forms.Label
Friend WithEvents labCustomerName As System.Windows.Forms.Label
Friend WithEvents labJobNumber As System.Windows.Forms.Label
Friend WithEvents txtJobNumber As System.Windows.Forms.TextBox
Friend WithEvents txtUserNote As System.Windows.Forms.TextBox
Friend WithEvents grpSystemServices As System.Windows.Forms.GroupBox
Friend WithEvents txtShopPSI As System.Windows.Forms.TextBox
Friend WithEvents labShopPsi As System.Windows.Forms.Label
Friend WithEvents labSystemVoltage As System.Windows.Forms.Label
Friend WithEvents labSystemPhase As System.Windows.Forms.Label
Friend WithEvents labSystemAmps As System.Windows.Forms.Label
Friend WithEvents txtSystemAmps As System.Windows.Forms.TextBox
Friend WithEvents lblpkJobId As System.Windows.Forms.Label
Friend WithEvents labJobId As System.Windows.Forms.Label
Friend WithEvents cboSystemPhase As System.Windows.Forms.ComboBox
Friend WithEvents cboSystemVoltage As System.Windows.Forms.ComboBox
Friend WithEvents chkHasCircuitBreakersYN As
System.Windows.Forms.CheckBox
Friend WithEvents chkApprovedYN As System.Windows.Forms.CheckBox
Friend WithEvents chkCompletedYN As System.Windows.Forms.CheckBox
Friend WithEvents labReferenceJobNumber As System.Windows.Forms.Label
Friend WithEvents lblReferenceJobNumber As System.Windows.Forms.Label
Friend WithEvents chkIsMasterYN As System.Windows.Forms.CheckBox
Friend WithEvents chkAllProcessesAddedYN As
System.Windows.Forms.CheckBox
Friend WithEvents chkAllProcessesConfiguredYN As
System.Windows.Forms.CheckBox
Friend WithEvents chkArchive As System.Windows.Forms.CheckBox
Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
Friend WithEvents lblCountOfJobs As System.Windows.Forms.Label
Friend WithEvents labTotalJobs As System.Windows.Forms.Label
Friend WithEvents chkAllTasksAddedYN As System.Windows.Forms.CheckBox
Friend WithEvents MsdnTextboxValidator1 As
MSDNTextboxValidator.MSDNTextboxValidator
Friend WithEvents ErrorProvider1 As System.Windows.Forms.ErrorProvider
Friend WithEvents txtCustomerName As System.Windows.Forms.TextBox
Friend WithEvents lblCountOfConfigured As System.Windows.Forms.Label
Friend WithEvents labTotalConfigured As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents btnExit As System.Windows.Forms.Button
Protected WithEvents txtEditedBy As System.Windows.Forms.TextBox
Protected WithEvents txtEditedOn As System.Windows.Forms.TextBox
Protected WithEvents txtCreatedBy As System.Windows.Forms.TextBox
Protected WithEvents txtCreatedOn As System.Windows.Forms.TextBox
Protected WithEvents labEditedBy As System.Windows.Forms.Label
Protected WithEvents labEditedOn As System.Windows.Forms.Label
Protected WithEvents labCreatedBy As System.Windows.Forms.Label
Protected WithEvents labCreatedOn As System.Windows.Forms.Label
Public WithEvents DataGrid1 As System.Windows.Forms.DataGrid
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.lblpkJobId = New System.Windows.Forms.Label
Me.labJobId = New System.Windows.Forms.Label
Me.chkCompletedYN = New System.Windows.Forms.CheckBox
Me.chkApprovedYN = New System.Windows.Forms.CheckBox
Me.labUserNote = New System.Windows.Forms.Label
Me.labReferenceJobNumber = New System.Windows.Forms.Label
Me.txtJobDescription = New System.Windows.Forms.TextBox
Me.labJobDescription = New System.Windows.Forms.Label
Me.labCustomerName = New System.Windows.Forms.Label
Me.labJobNumber = New System.Windows.Forms.Label
Me.txtJobNumber = New System.Windows.Forms.TextBox
Me.txtUserNote = New System.Windows.Forms.TextBox
Me.grpSystemServices = New System.Windows.Forms.GroupBox
Me.chkHasCircuitBreakersYN = New System.Windows.Forms.CheckBox
Me.txtSystemAmps = New System.Windows.Forms.TextBox
Me.labSystemAmps = New System.Windows.Forms.Label
Me.cboSystemPhase = New System.Windows.Forms.ComboBox
Me.labSystemPhase = New System.Windows.Forms.Label
Me.cboSystemVoltage = New System.Windows.Forms.ComboBox
Me.labSystemVoltage = New System.Windows.Forms.Label
Me.txtShopPSI = New System.Windows.Forms.TextBox
Me.labShopPsi = New System.Windows.Forms.Label
Me.chkIsMasterYN = New System.Windows.Forms.CheckBox
Me.lblReferenceJobNumber = New System.Windows.Forms.Label
Me.chkAllProcessesAddedYN = New System.Windows.Forms.CheckBox
Me.chkAllProcessesConfiguredYN = New System.Windows.Forms.CheckBox
Me.chkArchive = New System.Windows.Forms.CheckBox
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.txtCustomerName = New System.Windows.Forms.TextBox
Me.lblCountOfJobs = New System.Windows.Forms.Label
Me.labTotalJobs = New System.Windows.Forms.Label
Me.chkAllTasksAddedYN = New System.Windows.Forms.CheckBox
Me.MsdnTextboxValidator1 = New
MSDNTextboxValidator.MSDNTextboxValidator(Me.components)
Me.ErrorProvider1 = New System.Windows.Forms.ErrorProvider
Me.txtEditedBy = New System.Windows.Forms.TextBox
Me.txtEditedOn = New System.Windows.Forms.TextBox
Me.txtCreatedBy = New System.Windows.Forms.TextBox
Me.txtCreatedOn = New System.Windows.Forms.TextBox
Me.lblCountOfConfigured = New System.Windows.Forms.Label
Me.labTotalConfigured = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.btnExit = New System.Windows.Forms.Button
Me.labEditedBy = New System.Windows.Forms.Label
Me.labEditedOn = New System.Windows.Forms.Label
Me.labCreatedBy = New System.Windows.Forms.Label
Me.labCreatedOn = New System.Windows.Forms.Label
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.grpSystemServices.SuspendLayout()
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'lblpkJobId
'
Me.lblpkJobId.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.lblpkJobId.ForeColor = System.Drawing.SystemColors.GrayText
Me.lblpkJobId.Location = New System.Drawing.Point(120, 352)
Me.lblpkJobId.Name = "lblpkJobId"
Me.lblpkJobId.Size = New System.Drawing.Size(248, 23)
Me.lblpkJobId.TabIndex = 1
Me.lblpkJobId.Tag = ""
'
'labJobId
'
Me.labJobId.Location = New System.Drawing.Point(8, 352)
Me.labJobId.Name = "labJobId"
Me.labJobId.TabIndex = 0
Me.labJobId.Tag = ""
Me.labJobId.Text = "Job ID:"
'
'chkCompletedYN
'
Me.chkCompletedYN.Location = New System.Drawing.Point(744, 472)
Me.chkCompletedYN.Name = "chkCompletedYN"
Me.chkCompletedYN.Size = New System.Drawing.Size(160, 24)
Me.chkCompletedYN.TabIndex = 13
Me.chkCompletedYN.Tag = ""
Me.chkCompletedYN.Text = "Job Completed"
'
'chkApprovedYN
'
Me.chkApprovedYN.Location = New System.Drawing.Point(744, 448)
Me.chkApprovedYN.Name = "chkApprovedYN"
Me.chkApprovedYN.Size = New System.Drawing.Size(160, 24)
Me.chkApprovedYN.TabIndex = 12
Me.chkApprovedYN.Tag = ""
Me.chkApprovedYN.Text = "Approved for Programming"
'
'labUserNote
'
Me.labUserNote.Location = New System.Drawing.Point(328, 568)
Me.labUserNote.Name = "labUserNote"
Me.labUserNote.Size = New System.Drawing.Size(64, 23)
Me.labUserNote.TabIndex = 10
Me.labUserNote.Tag = ""
Me.labUserNote.Text = "User Note:"
'
'labReferenceJobNumber
'
Me.labReferenceJobNumber.Location = New System.Drawing.Point(8, 448)
Me.labReferenceJobNumber.Name = "labReferenceJobNumber"
Me.labReferenceJobNumber.TabIndex = 8
Me.labReferenceJobNumber.Tag = ""
Me.labReferenceJobNumber.Text = "Job Ref. Num. :"
'
'txtJobDescription
'
Me.txtJobDescription.BackColor = System.Drawing.SystemColors.Info
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtJobDescription,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtJobDescription,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtJobDescription,
"JobDescription")
Me.txtJobDescription.Location = New System.Drawing.Point(120, 424)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtJobDescription, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtJobDescription, "")
Me.txtJobDescription.Name = "txtJobDescription"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtJobDescription,
"")
Me.MsdnTextboxValidator1.SetRequired(Me.txtJobDescription, False)
Me.txtJobDescription.Size = New System.Drawing.Size(300, 20)
Me.txtJobDescription.TabIndex = 7
Me.txtJobDescription.Tag = ""
Me.txtJobDescription.Text = ""
Me.ToolTip1.SetToolTip(Me.txtJobDescription, "Please enter a maximum
of 75 letters.")
'
'labJobDescription
'
Me.labJobDescription.Location = New System.Drawing.Point(8, 424)
Me.labJobDescription.Name = "labJobDescription"
Me.labJobDescription.TabIndex = 6
Me.labJobDescription.Tag = ""
Me.labJobDescription.Text = "Job Description:"
'
'labCustomerName
'
Me.labCustomerName.Location = New System.Drawing.Point(8, 400)
Me.labCustomerName.Name = "labCustomerName"
Me.labCustomerName.TabIndex = 4
Me.labCustomerName.Tag = ""
Me.labCustomerName.Text = "Customer Name:"
'
'labJobNumber
'
Me.labJobNumber.Location = New System.Drawing.Point(8, 376)
Me.labJobNumber.Name = "labJobNumber"
Me.labJobNumber.TabIndex = 2
Me.labJobNumber.Tag = ""
Me.labJobNumber.Text = "Job Number:"
'
'txtJobNumber
'
Me.txtJobNumber.BackColor = System.Drawing.SystemColors.Info
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtJobNumber,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtJobNumber,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtJobNumber, "JobNumber")
Me.txtJobNumber.Location = New System.Drawing.Point(120, 376)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtJobNumber, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtJobNumber, "")
Me.txtJobNumber.Name = "txtJobNumber"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtJobNumber,
"^[a-zA-Z]{1,3}[0-9]{4}$")
Me.MsdnTextboxValidator1.SetRequired(Me.txtJobNumber, False)
Me.txtJobNumber.TabIndex = 3
Me.txtJobNumber.Tag = ""
Me.txtJobNumber.Text = ""
Me.ToolTip1.SetToolTip(Me.txtJobNumber, "Please enter a pattern of
1-3 letters and 4 numbers.")
'
'txtUserNote
'
Me.txtUserNote.BackColor = System.Drawing.SystemColors.Window
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtUserNote,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtUserNote,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtUserNote, "")
Me.txtUserNote.Location = New System.Drawing.Point(392, 568)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtUserNote, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtUserNote, "")
Me.txtUserNote.Multiline = True
Me.txtUserNote.Name = "txtUserNote"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtUserNote, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtUserNote, False)
Me.txtUserNote.Size = New System.Drawing.Size(300, 40)
Me.txtUserNote.TabIndex = 11
Me.txtUserNote.Tag = ""
Me.txtUserNote.Text = ""
Me.ToolTip1.SetToolTip(Me.txtUserNote, "Users notes such what
information might need verification.")
'
'grpSystemServices
'
Me.grpSystemServices.Controls.Add(Me.chkHasCircuitBreakersYN)
Me.grpSystemServices.Controls.Add(Me.txtSystemAmps)
Me.grpSystemServices.Controls.Add(Me.labSystemAmps)
Me.grpSystemServices.Controls.Add(Me.cboSystemPhase)
Me.grpSystemServices.Controls.Add(Me.labSystemPhase)
Me.grpSystemServices.Controls.Add(Me.cboSystemVoltage)
Me.grpSystemServices.Controls.Add(Me.labSystemVoltage)
Me.grpSystemServices.Controls.Add(Me.txtShopPSI)
Me.grpSystemServices.Controls.Add(Me.labShopPsi)
Me.grpSystemServices.Location = New System.Drawing.Point(432, 368)
Me.grpSystemServices.Name = "grpSystemServices"
Me.grpSystemServices.Size = New System.Drawing.Size(304, 152)
Me.grpSystemServices.TabIndex = 9
Me.grpSystemServices.TabStop = False
Me.grpSystemServices.Tag = ""
Me.grpSystemServices.Text = "System Services"
'
'chkHasCircuitBreakersYN
'
Me.chkHasCircuitBreakersYN.Location = New System.Drawing.Point(120,
120)
Me.chkHasCircuitBreakersYN.Name = "chkHasCircuitBreakersYN"
Me.chkHasCircuitBreakersYN.Size = New System.Drawing.Size(176, 24)
Me.chkHasCircuitBreakersYN.TabIndex = 8
Me.chkHasCircuitBreakersYN.Text = "Circuit Brakers (Fuses default)"
'
'txtSystemAmps
'
Me.txtSystemAmps.BackColor = System.Drawing.SystemColors.Info
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtSystemAmps,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtSystemAmps,
MSDNTextboxValidator.DataTypeConstants.Int16Type)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtSystemAmps,
"SystemAmps")
Me.txtSystemAmps.Location = New System.Drawing.Point(120, 96)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtSystemAmps, "999")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtSystemAmps, "0")
Me.txtSystemAmps.Name = "txtSystemAmps"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtSystemAmps, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtSystemAmps, False)
Me.txtSystemAmps.TabIndex = 7
Me.txtSystemAmps.Text = ""
Me.ToolTip1.SetToolTip(Me.txtSystemAmps, "Please enter an Integer
between 0 and 999.")
'
'labSystemAmps
'
Me.labSystemAmps.Location = New System.Drawing.Point(8, 96)
Me.labSystemAmps.Name = "labSystemAmps"
Me.labSystemAmps.TabIndex = 6
Me.labSystemAmps.Text = "System Amps"
'
'cboSystemPhase
'
Me.cboSystemPhase.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboSystemPhase.Location = New System.Drawing.Point(120, 72)
Me.cboSystemPhase.Name = "cboSystemPhase"
Me.cboSystemPhase.Size = New System.Drawing.Size(121, 21)
Me.cboSystemPhase.TabIndex = 5
'
'labSystemPhase
'
Me.labSystemPhase.Location = New System.Drawing.Point(8, 72)
Me.labSystemPhase.Name = "labSystemPhase"
Me.labSystemPhase.TabIndex = 4
Me.labSystemPhase.Text = "System Phase:"
'
'cboSystemVoltage
'
Me.cboSystemVoltage.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboSystemVoltage.Location = New System.Drawing.Point(120, 48)
Me.cboSystemVoltage.Name = "cboSystemVoltage"
Me.cboSystemVoltage.Size = New System.Drawing.Size(72, 21)
Me.cboSystemVoltage.TabIndex = 3
'
'labSystemVoltage
'
Me.labSystemVoltage.Location = New System.Drawing.Point(8, 48)
Me.labSystemVoltage.Name = "labSystemVoltage"
Me.labSystemVoltage.TabIndex = 2
Me.labSystemVoltage.Text = "System Voltage:"
'
'txtShopPSI
'
Me.txtShopPSI.BackColor = System.Drawing.SystemColors.Info
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtShopPSI,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtShopPSI,
MSDNTextboxValidator.DataTypeConstants.Int16Type)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtShopPSI, "ShipPSI")
Me.txtShopPSI.Location = New System.Drawing.Point(120, 24)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtShopPSI, "999")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtShopPSI, "0")
Me.txtShopPSI.Name = "txtShopPSI"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtShopPSI, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtShopPSI, False)
Me.txtShopPSI.TabIndex = 1
Me.txtShopPSI.Tag = "DataEntry"
Me.txtShopPSI.Text = ""
Me.ToolTip1.SetToolTip(Me.txtShopPSI, "Please enter an Integer
between 0 and 999.")
'
'labShopPsi
'
Me.labShopPsi.Location = New System.Drawing.Point(8, 24)
Me.labShopPsi.Name = "labShopPsi"
Me.labShopPsi.TabIndex = 0
Me.labShopPsi.Tag = "DataEntry"
Me.labShopPsi.Text = "Shop PSI (80):"
'
'chkIsMasterYN
'
Me.chkIsMasterYN.Location = New System.Drawing.Point(744, 496)
Me.chkIsMasterYN.Name = "chkIsMasterYN"
Me.chkIsMasterYN.Size = New System.Drawing.Size(160, 24)
Me.chkIsMasterYN.TabIndex = 14
Me.chkIsMasterYN.Tag = ""
Me.chkIsMasterYN.Text = "This Job is the Master"
'
'lblReferenceJobNumber
'
Me.lblReferenceJobNumber.BorderStyle =
System.Windows.Forms.BorderStyle.Fixed3D
Me.lblReferenceJobNumber.Location = New System.Drawing.Point(120,
448)
Me.lblReferenceJobNumber.Name = "lblReferenceJobNumber"
Me.lblReferenceJobNumber.TabIndex = 9
Me.lblReferenceJobNumber.Tag = ""
'
'chkAllProcessesAddedYN
'
Me.chkAllProcessesAddedYN.Enabled = False
Me.chkAllProcessesAddedYN.Location = New System.Drawing.Point(744,
376)
Me.chkAllProcessesAddedYN.Name = "chkAllProcessesAddedYN"
Me.chkAllProcessesAddedYN.Size = New System.Drawing.Size(160, 24)
Me.chkAllProcessesAddedYN.TabIndex = 26
Me.chkAllProcessesAddedYN.Tag = ""
Me.chkAllProcessesAddedYN.Text = "All Processes Added"
'
'chkAllProcessesConfiguredYN
'
Me.chkAllProcessesConfiguredYN.Enabled = False
Me.chkAllProcessesConfiguredYN.Location = New
System.Drawing.Point(744, 424)
Me.chkAllProcessesConfiguredYN.Name = "chkAllProcessesConfiguredYN"
Me.chkAllProcessesConfiguredYN.Size = New System.Drawing.Size(160,
24)
Me.chkAllProcessesConfiguredYN.TabIndex = 27
Me.chkAllProcessesConfiguredYN.Tag = ""
Me.chkAllProcessesConfiguredYN.Text = "All Processes Configured"
'
'chkArchive
'
Me.chkArchive.Location = New System.Drawing.Point(744, 520)
Me.chkArchive.Name = "chkArchive"
Me.chkArchive.Size = New System.Drawing.Size(160, 24)
Me.chkArchive.TabIndex = 28
Me.chkArchive.Tag = ""
Me.chkArchive.Text = "Archive (hide)"
'
'txtCustomerName
'
Me.txtCustomerName.BackColor = System.Drawing.SystemColors.Info
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtCustomerName,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtCustomerName,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtCustomerName,
"CustomerName")
Me.txtCustomerName.Location = New System.Drawing.Point(120, 400)
Me.txtCustomerName.MaxLength = 36
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtCustomerName, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtCustomerName, "")
Me.txtCustomerName.Name = "txtCustomerName"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtCustomerName, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtCustomerName, False)
Me.txtCustomerName.Size = New System.Drawing.Size(200, 20)
Me.txtCustomerName.TabIndex = 35
Me.txtCustomerName.Tag = ""
Me.txtCustomerName.Text = ""
Me.ToolTip1.SetToolTip(Me.txtCustomerName, "Please enter a maximum of
36 letters.")
'
'lblCountOfJobs
'
Me.lblCountOfJobs.BorderStyle =
System.Windows.Forms.BorderStyle.Fixed3D
Me.lblCountOfJobs.ForeColor = System.Drawing.SystemColors.GrayText
Me.lblCountOfJobs.Location = New System.Drawing.Point(120, 328)
Me.lblCountOfJobs.Name = "lblCountOfJobs"
Me.lblCountOfJobs.Size = New System.Drawing.Size(100, 16)
Me.lblCountOfJobs.TabIndex = 33
'
'labTotalJobs
'
Me.labTotalJobs.Location = New System.Drawing.Point(8, 328)
Me.labTotalJobs.Name = "labTotalJobs"
Me.labTotalJobs.Size = New System.Drawing.Size(100, 16)
Me.labTotalJobs.TabIndex = 32
Me.labTotalJobs.Text = "Total Jobs:"
'
'chkAllTasksAddedYN
'
Me.chkAllTasksAddedYN.Enabled = False
Me.chkAllTasksAddedYN.Location = New System.Drawing.Point(744, 400)
Me.chkAllTasksAddedYN.Name = "chkAllTasksAddedYN"
Me.chkAllTasksAddedYN.Size = New System.Drawing.Size(160, 24)
Me.chkAllTasksAddedYN.TabIndex = 34
Me.chkAllTasksAddedYN.Text = "All Tasks Added"
'
'MsdnTextboxValidator1
'
Me.MsdnTextboxValidator1.DisplayControl = Nothing
Me.MsdnTextboxValidator1.ErrorProvider = Me.ErrorProvider1
Me.MsdnTextboxValidator1.InvalidBackColor =
System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte),
CType(255, Byte))
Me.MsdnTextboxValidator1.TooltipProvider = Nothing
'
'ErrorProvider1
'
Me.ErrorProvider1.ContainerControl = Me
'
'txtEditedBy
'
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtEditedBy,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtEditedBy,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtEditedBy, "")
Me.txtEditedBy.Location = New System.Drawing.Point(120, 552)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtEditedBy, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtEditedBy, "")
Me.txtEditedBy.Name = "txtEditedBy"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtEditedBy, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtEditedBy, False)
Me.txtEditedBy.TabIndex = 72
Me.txtEditedBy.Tag = "RecordDoc"
Me.txtEditedBy.Text = ""
'
'txtEditedOn
'
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtEditedOn,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtEditedOn,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtEditedOn, "")
Me.txtEditedOn.Location = New System.Drawing.Point(120, 528)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtEditedOn, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtEditedOn, "")
Me.txtEditedOn.Name = "txtEditedOn"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtEditedOn, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtEditedOn, False)
Me.txtEditedOn.Size = New System.Drawing.Size(150, 20)
Me.txtEditedOn.TabIndex = 70
Me.txtEditedOn.Tag = "RecordDoc"
Me.txtEditedOn.Text = ""
'
'txtCreatedBy
'
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtCreatedBy,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtCreatedBy,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtCreatedBy, "")
Me.txtCreatedBy.Location = New System.Drawing.Point(120, 504)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtCreatedBy, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtCreatedBy, "")
Me.txtCreatedBy.Name = "txtCreatedBy"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtCreatedBy, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtCreatedBy, False)
Me.txtCreatedBy.TabIndex = 68
Me.txtCreatedBy.Tag = "RecordDoc"
Me.txtCreatedBy.Text = ""
'
'txtCreatedOn
'
Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtCreatedOn,
True)
Me.MsdnTextboxValidator1.SetDataType(Me.txtCreatedOn,
MSDNTextboxValidator.DataTypeConstants.StringType)
Me.MsdnTextboxValidator1.SetDisplayName(Me.txtCreatedOn, "")
Me.txtCreatedOn.Location = New System.Drawing.Point(120, 480)
Me.MsdnTextboxValidator1.SetMaxValue(Me.txtCreatedOn, "")
Me.MsdnTextboxValidator1.SetMinValue(Me.txtCreatedOn, "")
Me.txtCreatedOn.Name = "txtCreatedOn"
Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtCreatedOn, "")
Me.MsdnTextboxValidator1.SetRequired(Me.txtCreatedOn, False)
Me.txtCreatedOn.Size = New System.Drawing.Size(150, 20)
Me.txtCreatedOn.TabIndex = 66
Me.txtCreatedOn.Tag = "RecordDoc"
Me.txtCreatedOn.Text = ""
'
'lblCountOfConfigured
'
Me.lblCountOfConfigured.BorderStyle =
System.Windows.Forms.BorderStyle.Fixed3D
Me.lblCountOfConfigured.ForeColor =
System.Drawing.SystemColors.GrayText
Me.lblCountOfConfigured.Location = New System.Drawing.Point(352, 328)
Me.lblCountOfConfigured.Name = "lblCountOfConfigured"
Me.lblCountOfConfigured.Size = New System.Drawing.Size(100, 16)
Me.lblCountOfConfigured.TabIndex = 37
'
'labTotalConfigured
'
Me.labTotalConfigured.Location = New System.Drawing.Point(240, 328)
Me.labTotalConfigured.Name = "labTotalConfigured"
Me.labTotalConfigured.Size = New System.Drawing.Size(100, 16)
Me.labTotalConfigured.TabIndex = 36
Me.labTotalConfigured.Text = "Total Configured:"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(320, 480)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 38
Me.Button1.Text = "Button1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(320, 512)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 39
Me.Button2.Text = "Button2"
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(848, 584)
Me.btnExit.Name = "btnExit"
Me.btnExit.TabIndex = 63
Me.btnExit.Text = "Close"
'
'labEditedBy
'
Me.labEditedBy.Location = New System.Drawing.Point(8, 552)
Me.labEditedBy.Name = "labEditedBy"
Me.labEditedBy.TabIndex = 71
Me.labEditedBy.Tag = "RecordDoc"
Me.labEditedBy.Text = "Edited By:"
'
'labEditedOn
'
Me.labEditedOn.Location = New System.Drawing.Point(8, 528)
Me.labEditedOn.Name = "labEditedOn"
Me.labEditedOn.TabIndex = 69
Me.labEditedOn.Tag = "RecordDoc"
Me.labEditedOn.Text = "Edited On:"
'
'labCreatedBy
'
Me.labCreatedBy.Location = New System.Drawing.Point(8, 504)
Me.labCreatedBy.Name = "labCreatedBy"
Me.labCreatedBy.TabIndex = 67
Me.labCreatedBy.Tag = "RecordDoc"
Me.labCreatedBy.Text = "Created By:"
'
'labCreatedOn
'
Me.labCreatedOn.Location = New System.Drawing.Point(8, 480)
Me.labCreatedOn.Name = "labCreatedOn"
Me.labCreatedOn.TabIndex = 65
Me.labCreatedOn.Tag = "RecordDoc"
Me.labCreatedOn.Text = "Created On:"
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor =
System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(8, 120)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(920, 200)
Me.DataGrid1.TabIndex = 0
'
'f010Jobs
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(944, 644)
Me.Controls.Add(Me.txtEditedBy)
Me.Controls.Add(Me.txtEditedOn)
Me.Controls.Add(Me.txtCreatedBy)
Me.Controls.Add(Me.txtCreatedOn)
Me.Controls.Add(Me.labEditedBy)
Me.Controls.Add(Me.labEditedOn)
Me.Controls.Add(Me.labCreatedBy)
Me.Controls.Add(Me.labCreatedOn)
Me.Controls.Add(Me.DataGrid1)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.lblCountOfConfigured)
Me.Controls.Add(Me.labTotalConfigured)
Me.Controls.Add(Me.txtCustomerName)
Me.Controls.Add(Me.chkAllTasksAddedYN)
Me.Controls.Add(Me.lblCountOfJobs)
Me.Controls.Add(Me.labTotalJobs)
Me.Controls.Add(Me.chkArchive)
Me.Controls.Add(Me.chkAllProcessesConfiguredYN)
Me.Controls.Add(Me.chkAllProcessesAddedYN)
Me.Controls.Add(Me.lblReferenceJobNumber)
Me.Controls.Add(Me.chkIsMasterYN)
Me.Controls.Add(Me.grpSystemServices)
Me.Controls.Add(Me.txtUserNote)
Me.Controls.Add(Me.txtJobNumber)
Me.Controls.Add(Me.lblpkJobId)
Me.Controls.Add(Me.labJobId)
Me.Controls.Add(Me.chkCompletedYN)
Me.Controls.Add(Me.chkApprovedYN)
Me.Controls.Add(Me.labUserNote)
Me.Controls.Add(Me.labReferenceJobNumber)
Me.Controls.Add(Me.txtJobDescription)
Me.Controls.Add(Me.labJobDescription)
Me.Controls.Add(Me.labCustomerName)
Me.Controls.Add(Me.labJobNumber)
Me.Name = "f010Jobs"
Me.Text = "f010Jobs"
Me.grpSystemServices.ResumeLayout(False)
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Protected DAL As New CLIP.DataAccess
Protected _dataSet1 As CLIP.dsTables
Protected _currentTable As String
Protected _dt As DataTable
Protected WithEvents _bmb As BindingManagerBase
'ComboBox Control
Private _bStillPopulatingCboVoltage As Boolean = True
Private _bStillPopulatingCboPhase As Boolean = True
Protected Sub DataGrid1_CurrentCellChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
_bmb.Position = DataGrid1.CurrentCell.RowNumber
End Sub
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me._dataSet1 = New CLIP.dsTables
_currentTable = "tbl010Job"
_dt = _dataSet1.tbl010Job
Call FillDataSet()
Call SetBindings()
End Sub
Private Sub FillDataSet()
DAL.sqlConn.Open()
DAL.da104Voltage_Cbo.Fill(_dataSet1, "lkp104Voltage")
DAL.da102Phase_Cbo.Fill(_dataSet1, "lkp102Phase")
DAL.da010JobFrm.Fill(_dataSet1, "tbl010Job")
DAL.sqlConn.Close()
DAL.sqlConn.Close()
End Sub
Private Sub SetBindings()
'[ComboBox]
Me.cboSystemVoltage.DataSource = _dataSet1
Me.cboSystemVoltage.DisplayMember = "lkp104Voltage.Voltage"
Me.cboSystemVoltage.ValueMember = "lkp104Voltage.pkVoltageId"
Me.cboSystemPhase.DataSource = _dataSet1
Me.cboSystemPhase.DisplayMember = "lkp102Phase.Phase"
Me.cboSystemPhase.ValueMember = "lkp102Phase.pkPhaseId"
'[DataGrid]
Me.DataGrid1.DataMember = "tbl010Job"
Me.DataGrid1.DataSource = _dataSet1
'[Controls]
Me.lblpkJobId.DataBindings.Add("Text", _dt, "pkJobId")
Me.txtJobNumber.DataBindings.Add("Text", _dt, "JobNumber")
Me.txtCustomerName.DataBindings.Add("Text", _dt, "CustomerName")
Me.txtJobDescription.DataBindings.Add("Text", _dt, "JobDescription")
Me.lblReferenceJobNumber.DataBindings.Add("Text", _dt,
"ReferenceJobNumber")
Me.txtShopPSI.DataBindings.Add("Text", _dt, "ShopPsi")
Me.cboSystemVoltage.DataBindings.Add("SelectedValue", _dt,
"SystemVoltage")
Me.cboSystemPhase.DataBindings.Add("SelectedValue", _dt,
"SystemPhase")
Me.txtSystemAmps.DataBindings.Add("Text", _dt, "SystemAmps")
Me.chkHasCircuitBreakersYN.DataBindings.Add("Checked", _dt,
"HasCircuitBreakersYN")
Me.chkAllProcessesAddedYN.DataBindings.Add("Checked", _dt,
"AllProcessesAddedYN")
Me.chkAllTasksAddedYN.DataBindings.Add("Checked", _dt,
"AllTasksAddedYN")
Me.chkAllProcessesConfiguredYN.DataBindings.Add("Checked", _dt,
"AllProcessesConfiguredYN")
Me.chkApprovedYN.DataBindings.Add("Checked", _dt, "ApprovedYN")
Me.chkCompletedYN.DataBindings.Add("Checked", _dt, "CompletedYN")
Me.chkIsMasterYN.DataBindings.Add("Checked", _dt, "IsMasterYN")
Me.chkArchive.DataBindings.Add("Checked", _dt, "Archive")
Me.txtUserNote.DataBindings.Add("Text", _dt, "jcUserNote")
Me.txtCreatedOn.DataBindings.Add("Text", _dt, "jcCreatedOn")
Me.txtCreatedBy.DataBindings.Add("Text", _dt, "jcCreatedBy")
Me.txtEditedOn.DataBindings.Add("Text", _dt, "jcEditedOn")
Me.txtEditedBy.DataBindings.Add("Text", _dt, "jcEditedBy")
'[BindingContext]
_bmb = Me.BindingContext(_dt)
_bmb.Position = 0
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
//
======================
2.) Here are (3) Data Tables (1 data table, two lookups)
\\
CREATE TABLE [tbl010Job] (
[pkJobId] [char] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
CONSTRAINT [DF_tbl010JobCustomer_pkJobId] DEFAULT (newid()),
[JobNumber] [varchar] (7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[CustomerName] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[JobDescription] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[ReferenceJobNumber] [varchar] (7) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[ShopPsi] [tinyint] NULL ,
[SystemVoltage] [int] NULL ,
[SystemPhase] [int] NULL ,
[SystemAmps] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[HasCircuitBreakersYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_HasCircuitBreakersYN] DEFAULT (0),
[AllProcessesAddedYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_AllProcessesPresentYN] DEFAULT (0),
[AllProcessesConfiguredYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_AllChildConfigsCompleteYN] DEFAULT (0),
[ApprovedYN] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_ApprovedYN]
DEFAULT (0),
[CompletedYN] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_CompletedYN]
DEFAULT (0),
[IsMasterYN] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_IsMasterYN]
DEFAULT (0),
[Archive] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_ARCHIVE] DEFAULT
(0),
[jcUserNote] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[jcCreatedOn] [smalldatetime] NOT NULL ,
[jcCreatedBy] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[jcEditedOn] [smalldatetime] NOT NULL ,
[jcEditedBy] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[jcrowversion] [timestamp] NOT NULL ,
[AllTasksAddedYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_AllTasksAddedYN] DEFAULT (0),
CONSTRAINT [PK_tbl010Job] PRIMARY KEY CLUSTERED
(
[pkJobId]
) ON [PRIMARY]
) ON [PRIMARY]
GO
//
\\
CREATE TABLE [lkp102Phase] (
[pkPhaseId] [int] IDENTITY (1, 1) NOT NULL ,
[Phase] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Ord] [tinyint] NOT NULL CONSTRAINT [DF_lkp102Phase_ord] DEFAULT (0),
[Hide] [bit] NOT NULL CONSTRAINT [DF_lkp102Phase_hide] DEFAULT (0),
CONSTRAINT [PK_lkp102Phase] PRIMARY KEY CLUSTERED
(
[pkPhaseId]
) ON [PRIMARY]
) ON [PRIMARY]
GO
//
\\
CREATE TABLE [lkp104Voltage] (
[pkVoltageId] [int] IDENTITY (1, 1) NOT NULL ,
[Voltage] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
,
[Ord] [tinyint] NOT NULL CONSTRAINT [DF_lkp104Voltage_ord] DEFAULT
(0),
[Hide] [bit] NOT NULL CONSTRAINT [DF_lkp104Voltage_hide] DEFAULT (0),
CONSTRAINT [PK_lkp104Voltage] PRIMARY KEY CLUSTERED
(
[pkVoltageId]
) ON [PRIMARY]
) ON [PRIMARY]
GO
//
======================
3.) Here is sample data
\\
pkJobId,JobNumber,CustomerName,JobDescription,ReferenceJobNumber,ShopPsi,SystemVoltage,SystemPhase,SystemAmps,HasCircuitBreakersYN,AllProcessesAddedYN,AllProcessesConfiguredYN,ApprovedYN,CompletedYN,IsMasterYN,Archive,jcUserNote,jcCreatedOn,jcCreatedBy,jcEditedOn,jcEditedBy,jcrowversion,AllTasksAddedYN
166aba12-e302-4e1e-9723-299ed9a40aad,P1161,Plastech,DCX RH/LH A Piller
Cap
Clip,,75,2,3,100,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,,9/1/2005,dbuchanan,9/6/2005,dbuchanan,00000000000163DE,FALSE
582E2CC9-BCDF-49C4-ACE1-3697DEF54A53,F1136,Frax,To this do
that,,,,,,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,,9/12/2005,db,9/12/2005,db,000000000001641C,FALSE
5F8E9720-4C24-47AF-B7E1-7168784BE30A,G1137,Graxton,Something
else,,,,,,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,,9/12/2005,db,9/12/2005,db,000000000001641E,FALSE
//
lkp102Phase
\\
1,DC,1,0
2,1-Pase,2,0
3,2-Phase,3,0
4,3-Phase,4,0
//
lkp104Voltage
\\
1,24,1,0
2,120,2,0
3,240,3,0
4,480,4,0
5,500,5,0
//
======================
4.) Here is the data set (dsTables.vb)
\\
Public Class dsTables
Inherits DataSet
'[DataTables]
Friend tbl010Job As New DataTable
Friend lkp102Phase As New DataTable
Friend lkp104Voltage As New DataTable
'[Constructor]
Public Sub New()
MyBase.New()
Call InitializeComponent()
End Sub
'[Initialize class component]
Private Sub InitializeComponent()
'[Add Tables to the DataSet]
Me.tbl010Job = Me.Tables.Add("tbl010Job")
Me.lkp102Phase = Me.Tables.Add("lkp102Phase")
Me.lkp104Voltage = Me.Tables.Add("lkp104Voltage")
'[Add Columns to the DataTables]
' tbl010Job
Dim pkJobId As DataColumn = Me.tbl010Job.Columns.Add("pkJobId",
GetType(String)) : pkJobId.MaxLength = 36 : pkJobId.AllowDBNull = False
Dim JobNumber As DataColumn =
Me.tbl010Job.Columns.Add("JobNumber", GetType(String)) :
JobNumber.MaxLength = 7 : JobNumber.AllowDBNull = False
Dim CustomerName As DataColumn =
Me.tbl010Job.Columns.Add("CustomerName", GetType(String)) :
CustomerName.MaxLength = 25 : CustomerName.AllowDBNull = False
Dim JobDescription As DataColumn =
Me.tbl010Job.Columns.Add("JobDescription", GetType(String)) :
JobDescription.MaxLength = 75 : JobDescription.AllowDBNull = False
Dim ReferenceJobNumber As DataColumn =
Me.tbl010Job.Columns.Add("ReferenceJobNumber", GetType(String)) :
ReferenceJobNumber.MaxLength = 7 : ReferenceJobNumber.AllowDBNull =
True
Dim ShopPsi As DataColumn = Me.tbl010Job.Columns.Add("ShopPsi",
GetType(Byte)) : ShopPsi.AllowDBNull = True 'ShopPsi.DefaultValue = 80
'Would this send the value to a new row? 'TODO - dsTables -
DatsColumn.DefaultValue
Dim SystemVoltage As DataColumn =
Me.tbl010Job.Columns.Add("SystemVoltage", GetType(Int32)) :
SystemVoltage.AllowDBNull = True
Dim SystemPhase As DataColumn =
Me.tbl010Job.Columns.Add("SystemPhase", GetType(Int32)) :
SystemPhase.AllowDBNull = True
Dim SystemAmps As DataColumn =
Me.tbl010Job.Columns.Add("SystemAmps", GetType(String)) :
SystemAmps.MaxLength = 3 : SystemAmps.AllowDBNull = True
Dim HasCircuitBreakersYN As DataColumn =
Me.tbl010Job.Columns.Add("HasCircuitBreakersYN", GetType(Boolean)) :
HasCircuitBreakersYN.AllowDBNull = False
Dim AllProcessesAddedYN As DataColumn =
Me.tbl010Job.Columns.Add("AllProcessesAddedYN", GetType(Boolean)) :
AllProcessesAddedYN.AllowDBNull = False
Dim AllTasksAddedYN As DataColumn =
Me.tbl010Job.Columns.Add("AllTasksAddedYN", GetType(Boolean)) :
AllTasksAddedYN.AllowDBNull = False
Dim AllProcessesConfiguredYN As DataColumn =
Me.tbl010Job.Columns.Add("AllProcessesConfiguredYN", GetType(Boolean))
: AllProcessesConfiguredYN.AllowDBNull = False
Dim ApprovedYN As DataColumn =
Me.tbl010Job.Columns.Add("ApprovedYN", GetType(Boolean)) :
ApprovedYN.AllowDBNull = False
Dim CompletedYN As DataColumn =
Me.tbl010Job.Columns.Add("CompletedYN", GetType(Boolean)) :
CompletedYN.AllowDBNull = False
Dim IsMasterYN As DataColumn =
Me.tbl010Job.Columns.Add("IsMasterYN", GetType(Boolean)) :
IsMasterYN.AllowDBNull = False
Dim Archive As DataColumn = Me.tbl010Job.Columns.Add("Archive",
GetType(Boolean)) : Archive.AllowDBNull = False
Dim jcUserNote As DataColumn = Me.tbl010Job.Columns.Add("jcUserNote",
GetType(String)) : jcUserNote.MaxLength = 100 : jcUserNote.AllowDBNull
= False
Dim jcCreatedOn As DataColumn =
Me.tbl010Job.Columns.Add("jcCreatedOn", GetType(DateTime)) :
jcCreatedOn.AllowDBNull = False
Dim jcCreatedBy As DataColumn =
Me.tbl010Job.Columns.Add("jcCreatedBy", GetType(String)) :
jcCreatedBy.MaxLength = 25 : jcCreatedBy.AllowDBNull = False
Dim jcEditedOn As DataColumn =
Me.tbl010Job.Columns.Add("jcEditedOn", GetType(DateTime)) :
jcEditedOn.AllowDBNull = False
Dim jcEditedBy As DataColumn = Me.tbl010Job.Columns.Add("jcEditedBy",
GetType(String)) : jcEditedBy.MaxLength = 25 : jcEditedBy.AllowDBNull =
False
Dim jcrowversion As DataColumn =
Me.tbl010Job.Columns.Add("jcrowversion", GetType(Byte())) :
jcrowversion.AllowDBNull = True
' lkp102Phase
Dim pkPhaseId As DataColumn = Me.lkp102Phase.Columns.Add("pkPhaseId",
GetType(Int32)) : pkPhaseId.AllowDBNull = False
Dim Phase As DataColumn = Me.lkp102Phase.Columns.Add("Phase",
GetType(String)) : Phase.MaxLength = 50 : Phase.AllowDBNull = False
Dim Ord102 As DataColumn = Me.lkp102Phase.Columns.Add("Ord",
GetType(Byte)) : Ord102.AllowDBNull = False
Dim Hide102 As DataColumn = Me.lkp102Phase.Columns.Add("Hide",
GetType(Boolean)) : Hide102.AllowDBNull = False
' lkp104Voltage
Dim pkVoltageId As DataColumn =
Me.lkp104Voltage.Columns.Add("pkVoltageId", GetType(Int32)) :
pkVoltageId.AllowDBNull = False
Dim Voltage As DataColumn = Me.lkp104Voltage.Columns.Add("Voltage",
GetType(String)) : Voltage.MaxLength = 3 : Voltage.AllowDBNull = False
Dim Ord104 As DataColumn = Me.lkp104Voltage.Columns.Add("Ord",
GetType(Byte)) : Ord104.AllowDBNull = False
Dim Hide104 As DataColumn =
Me.lkp104Voltage.Columns.Add("Hide", GetType(Boolean)) :
Hide104.AllowDBNull = False
'[Simple PK Constraints - (one line)]
tbl010Job.PrimaryKey = New DataColumn()
{tbl010Job.Columns("pkJobID")}
lkp102Phase.PrimaryKey = New DataColumn()
{lkp102Phase.Columns("pkPhaseId")}
lkp104Voltage.PrimaryKey = New DataColumn()
{lkp104Voltage.Columns("pkVoltageId")}
End Sub
End Class
//
======================
5.) Here is the Data Access code (DataAccess.vb)
\\
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.Configuration
Public Class DataAccess
' This class is used to for full access to the main tables
' tbl010Job
' tbl020Proc
' tbl030Devi [2]
' tbl040Cmpt [7] [8] ~ use the same commands, but supply different
Stored Procedures
'This class is also used for access to the lookup tables for
comboBoxes
'See the other DataAccess Class named DataAccessLkpAdmin for code
' that allows administrative select, update, insert and delete on
those tables.
#Region " Variables - [ Connection | DataAdapters ] "
'=== [Connection] =================================
Friend sqlConn As New SqlConnection
'=== [DataAdapters] ===============================
Friend da010JobFrm As New SqlDataAdapter 'uses 'usp_Job_selVoltPhase'
'For ComboBoxes
Friend da102Phase_Cbo As New SqlDataAdapter ' for select only
Friend da104Voltage_Cbo As New SqlDataAdapter ' for select only
'=== [Commands] ==============================
Private Cmd010JobFrm_Sel As New SqlCommand
Private Cmd010JobFrm_Ins As New SqlCommand
Private Cmd010JobFrm_Upd As New SqlCommand
Private Cmd010JobFrm_Del As New SqlCommand
'=== [Commands - ComboBoxes] ========================
Private Cmd102Phase_Sel As New SqlCommand
Private Cmd104Voltage_Sel As New SqlCommand
#End Region
'[Constructor]
Public Sub New()
MyBase.New()
Call InitializeComponent()
End Sub
#Region " InitializeComponent - [ Instantiate (Connection,
DataAdapters, Commands), Give value (Connection String)] "
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
'=== [Connection String] ========================
Dim connectionString As String
connectionString =
ConfigurationSettings.AppSettings("ConnectionString")
Me.sqlConn.ConnectionString = connectionString
'=== [Set Cmds - Forms] ======================
With da010JobFrm
.SelectCommand = Cmd010JobFrm_Sel
.InsertCommand = Cmd010JobFrm_Ins
.UpdateCommand = Cmd010JobFrm_Upd
.DeleteCommand = Cmd010JobFrm_Del
End With
'=== [Set Cmds - ComboBoxes] ================
da102Phase_Cbo.SelectCommand = Cmd102Phase_Sel
da104Voltage_Cbo.SelectCommand = Cmd104Voltage_Sel
'### da010JobFrm ##################
'Select
With Cmd010JobFrm_Sel
.CommandType = CommandType.StoredProcedure
.CommandText = "usp_Job_sel_VoltPhase"
.Connection = sqlConn
With Cmd010JobFrm_Sel.Parameters
.Add(New SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4,
ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte),
"", DataRowVersion.Current, Nothing))
End With
End With
'%%% da102Phase_Cbo %%%%%%%%%%%%%%%%%
'Select
With Cmd102Phase_Sel
.CommandType = CommandType.StoredProcedure
.CommandText = "usp_102Phase_sel_cbo"
.Connection = sqlConn
With Cmd102Phase_Sel.Parameters
.Add(New SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4,
ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte),
"", DataRowVersion.Current, Nothing))
End With
End With
'%%% da104Voltage_Cbo %%%%%%%%%%%%%%%%
'Select
With Cmd104Voltage_Sel
.CommandType = CommandType.StoredProcedure
.CommandText = "usp_104Voltage_sel_cbo"
.Connection = sqlConn
With Cmd104Voltage_Sel.Parameters
.Add(New SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4,
ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte),
"", DataRowVersion.Current, Nothing))
End With
End With
End Sub
#End Region
End Class
//
======================
6.) Here are (3) stored procedures
"usp_Job_sel_VoltPhase"
\\
CREATE PROCEDURE dbo.usp_Job_sel_VoltPhase
AS SET NOCOUNT ON;
SELECT
j.pkJobId,
j.JobNumber,
j.CustomerName,
j.JobDescription,
j.ShopPsi,
j.SystemVoltage,
v.Voltage,
j.SystemPhase,
ph.Phase,
j.SystemAmps,
j.HasCircuitBreakersYN,
j.ReferenceJobNumber,
j.AllProcessesAddedYN,
j.AllProcessesConfiguredYN,
j.AllTasksAddedYN,
j.ApprovedYN,
j.CompletedYN,
j.IsMasterYN,
j.Archive,
j.jcUserNote,
j.jcCreatedOn,
j.jcCreatedBy,
j.jcEditedOn,
j.jcEditedBy,
j.jcrowversion
FROM
tbl010Job j
-- INNER JOIN lkp104Voltage v ON j.SystemVoltage = v. pkVoltageId
-- INNER JOIN lkp102Phase ph ON j.SystemPhase = ph. pkPhaseId
LEFT OUTER JOIN lkp104Voltage v ON j.SystemVoltage = v. pkVoltageId
LEFT OUTER JOIN lkp102Phase ph ON j.SystemPhase = ph. pkPhaseId
ORDER BY j.jcCreatedOn DESC
GO
//
"usp_102Phase_sel_cbo"
\\
CREATE PROCEDURE dbo.usp_102Phase_sel_cbo
AS
SET NOCOUNT ON;
SELECT
pkPhaseId,
Phase,
Ord,
Hide
FROM lkp102Phase
WHERE (Hide = 0)
Order By Ord, Phase
GO
//
"usp_104Voltage_sel_cbo"
\\
CREATE PROCEDURE dbo.usp_104Voltage_sel_cbo
AS
SET NOCOUNT ON;
SELECT
pkVoltageId,
Voltage,
Ord,
Hide
FROM lkp104Voltage
WHERE (Hide = 0)
ORDER BY Ord, Voltage
GO
//
Thank you for taking a look at this