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.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() 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.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'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 txtJobDescripti on As System.Windows. Forms.TextBox
Friend WithEvents labJobDescripti on 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 grpSystemServic es As System.Windows. Forms.GroupBox
Friend WithEvents txtShopPSI As System.Windows. Forms.TextBox
Friend WithEvents labShopPsi As System.Windows. Forms.Label
Friend WithEvents labSystemVoltag e 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 cboSystemVoltag e As System.Windows. Forms.ComboBox
Friend WithEvents chkHasCircuitBr eakersYN As
System.Windows. Forms.CheckBox
Friend WithEvents chkApprovedYN As System.Windows. Forms.CheckBox
Friend WithEvents chkCompletedYN As System.Windows. Forms.CheckBox
Friend WithEvents labReferenceJob Number As System.Windows. Forms.Label
Friend WithEvents lblReferenceJob Number As System.Windows. Forms.Label
Friend WithEvents chkIsMasterYN As System.Windows. Forms.CheckBox
Friend WithEvents chkAllProcesses AddedYN As
System.Windows. Forms.CheckBox
Friend WithEvents chkAllProcesses ConfiguredYN 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 chkAllTasksAdde dYN As System.Windows. Forms.CheckBox
Friend WithEvents MsdnTextboxVali dator1 As
MSDNTextboxVali dator.MSDNTextb oxValidator
Friend WithEvents ErrorProvider1 As System.Windows. Forms.ErrorProv ider
Friend WithEvents txtCustomerName As System.Windows. Forms.TextBox
Friend WithEvents lblCountOfConfi gured As System.Windows. Forms.Label
Friend WithEvents labTotalConfigu red 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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.components = New System.Componen tModel.Containe r
Me.lblpkJobId = New System.Windows. Forms.Label
Me.labJobId = New System.Windows. Forms.Label
Me.chkCompleted YN = New System.Windows. Forms.CheckBox
Me.chkApprovedY N = New System.Windows. Forms.CheckBox
Me.labUserNote = New System.Windows. Forms.Label
Me.labReference JobNumber = New System.Windows. Forms.Label
Me.txtJobDescri ption = New System.Windows. Forms.TextBox
Me.labJobDescri ption = New System.Windows. Forms.Label
Me.labCustomerN ame = 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.grpSystemSer vices = New System.Windows. Forms.GroupBox
Me.chkHasCircui tBreakersYN = New System.Windows. Forms.CheckBox
Me.txtSystemAmp s = New System.Windows. Forms.TextBox
Me.labSystemAmp s = New System.Windows. Forms.Label
Me.cboSystemPha se = New System.Windows. Forms.ComboBox
Me.labSystemPha se = New System.Windows. Forms.Label
Me.cboSystemVol tage = New System.Windows. Forms.ComboBox
Me.labSystemVol tage = New System.Windows. Forms.Label
Me.txtShopPSI = New System.Windows. Forms.TextBox
Me.labShopPsi = New System.Windows. Forms.Label
Me.chkIsMasterY N = New System.Windows. Forms.CheckBox
Me.lblReference JobNumber = New System.Windows. Forms.Label
Me.chkAllProces sesAddedYN = New System.Windows. Forms.CheckBox
Me.chkAllProces sesConfiguredYN = New System.Windows. Forms.CheckBox
Me.chkArchive = New System.Windows. Forms.CheckBox
Me.ToolTip1 = New System.Windows. Forms.ToolTip(M e.components)
Me.txtCustomerN ame = New System.Windows. Forms.TextBox
Me.lblCountOfJo bs = New System.Windows. Forms.Label
Me.labTotalJobs = New System.Windows. Forms.Label
Me.chkAllTasksA ddedYN = New System.Windows. Forms.CheckBox
Me.MsdnTextboxV alidator1 = New
MSDNTextboxVali dator.MSDNTextb oxValidator(Me. components)
Me.ErrorProvide r1 = New System.Windows. Forms.ErrorProv ider
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.lblCountOfCo nfigured = New System.Windows. Forms.Label
Me.labTotalConf igured = 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.grpSystemSer vices.SuspendLa yout()
CType(Me.DataGr id1,
System.Componen tModel.ISupport Initialize).Beg inInit()
Me.SuspendLayou t()
'
'lblpkJobId
'
Me.lblpkJobId.B orderStyle = System.Windows. Forms.BorderSty le.Fixed3D
Me.lblpkJobId.F oreColor = System.Drawing. SystemColors.Gr ayText
Me.lblpkJobId.L ocation = New System.Drawing. Point(120, 352)
Me.lblpkJobId.N ame = "lblpkJobId "
Me.lblpkJobId.S ize = New System.Drawing. Size(248, 23)
Me.lblpkJobId.T abIndex = 1
Me.lblpkJobId.T ag = ""
'
'labJobId
'
Me.labJobId.Loc ation = New System.Drawing. Point(8, 352)
Me.labJobId.Nam e = "labJobId"
Me.labJobId.Tab Index = 0
Me.labJobId.Tag = ""
Me.labJobId.Tex t = "Job ID:"
'
'chkCompletedYN
'
Me.chkCompleted YN.Location = New System.Drawing. Point(744, 472)
Me.chkCompleted YN.Name = "chkCompletedYN "
Me.chkCompleted YN.Size = New System.Drawing. Size(160, 24)
Me.chkCompleted YN.TabIndex = 13
Me.chkCompleted YN.Tag = ""
Me.chkCompleted YN.Text = "Job Completed"
'
'chkApprovedYN
'
Me.chkApprovedY N.Location = New System.Drawing. Point(744, 448)
Me.chkApprovedY N.Name = "chkApprove dYN"
Me.chkApprovedY N.Size = New System.Drawing. Size(160, 24)
Me.chkApprovedY N.TabIndex = 12
Me.chkApprovedY N.Tag = ""
Me.chkApprovedY N.Text = "Approved for Programming"
'
'labUserNote
'
Me.labUserNote. Location = New System.Drawing. Point(328, 568)
Me.labUserNote. Name = "labUserNot e"
Me.labUserNote. Size = New System.Drawing. Size(64, 23)
Me.labUserNote. TabIndex = 10
Me.labUserNote. Tag = ""
Me.labUserNote. Text = "User Note:"
'
'labReferenceJo bNumber
'
Me.labReference JobNumber.Locat ion = New System.Drawing. Point(8, 448)
Me.labReference JobNumber.Name = "labReferenceJo bNumber"
Me.labReference JobNumber.TabIn dex = 8
Me.labReference JobNumber.Tag = ""
Me.labReference JobNumber.Text = "Job Ref. Num. :"
'
'txtJobDescript ion
'
Me.txtJobDescri ption.BackColor = System.Drawing. SystemColors.In fo
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtJo bDescription,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtJo bDescription,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tJobDescription ,
"JobDescription ")
Me.txtJobDescri ption.Location = New System.Drawing. Point(120, 424)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtJo bDescription, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtJo bDescription, "")
Me.txtJobDescri ption.Name = "txtJobDescript ion"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtJobDescr iption,
"")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtJo bDescription, False)
Me.txtJobDescri ption.Size = New System.Drawing. Size(300, 20)
Me.txtJobDescri ption.TabIndex = 7
Me.txtJobDescri ption.Tag = ""
Me.txtJobDescri ption.Text = ""
Me.ToolTip1.Set ToolTip(Me.txtJ obDescription, "Please enter a maximum
of 75 letters.")
'
'labJobDescript ion
'
Me.labJobDescri ption.Location = New System.Drawing. Point(8, 424)
Me.labJobDescri ption.Name = "labJobDescript ion"
Me.labJobDescri ption.TabIndex = 6
Me.labJobDescri ption.Tag = ""
Me.labJobDescri ption.Text = "Job Description:"
'
'labCustomerNam e
'
Me.labCustomerN ame.Location = New System.Drawing. Point(8, 400)
Me.labCustomerN ame.Name = "labCustomerNam e"
Me.labCustomerN ame.TabIndex = 4
Me.labCustomerN ame.Tag = ""
Me.labCustomerN ame.Text = "Customer Name:"
'
'labJobNumber
'
Me.labJobNumber .Location = New System.Drawing. Point(8, 376)
Me.labJobNumber .Name = "labJobNumb er"
Me.labJobNumber .TabIndex = 2
Me.labJobNumber .Tag = ""
Me.labJobNumber .Text = "Job Number:"
'
'txtJobNumber
'
Me.txtJobNumber .BackColor = System.Drawing. SystemColors.In fo
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtJo bNumber,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtJo bNumber,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tJobNumber, "JobNumber" )
Me.txtJobNumber .Location = New System.Drawing. Point(120, 376)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtJo bNumber, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtJo bNumber, "")
Me.txtJobNumber .Name = "txtJobNumb er"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtJobNumbe r,
"^[a-zA-Z]{1,3}[0-9]{4}$")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtJo bNumber, False)
Me.txtJobNumber .TabIndex = 3
Me.txtJobNumber .Tag = ""
Me.txtJobNumber .Text = ""
Me.ToolTip1.Set ToolTip(Me.txtJ obNumber, "Please enter a pattern of
1-3 letters and 4 numbers.")
'
'txtUserNote
'
Me.txtUserNote. BackColor = System.Drawing. SystemColors.Wi ndow
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtUs erNote,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtUs erNote,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tUserNote, "")
Me.txtUserNote. Location = New System.Drawing. Point(392, 568)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtUs erNote, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtUs erNote, "")
Me.txtUserNote. Multiline = True
Me.txtUserNote. Name = "txtUserNot e"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtUserNote , "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtUs erNote, False)
Me.txtUserNote. Size = New System.Drawing. Size(300, 40)
Me.txtUserNote. TabIndex = 11
Me.txtUserNote. Tag = ""
Me.txtUserNote. Text = ""
Me.ToolTip1.Set ToolTip(Me.txtU serNote, "Users notes such what
information might need verification.")
'
'grpSystemServi ces
'
Me.grpSystemSer vices.Controls. Add(Me.chkHasCi rcuitBreakersYN )
Me.grpSystemSer vices.Controls. Add(Me.txtSyste mAmps)
Me.grpSystemSer vices.Controls. Add(Me.labSyste mAmps)
Me.grpSystemSer vices.Controls. Add(Me.cboSyste mPhase)
Me.grpSystemSer vices.Controls. Add(Me.labSyste mPhase)
Me.grpSystemSer vices.Controls. Add(Me.cboSyste mVoltage)
Me.grpSystemSer vices.Controls. Add(Me.labSyste mVoltage)
Me.grpSystemSer vices.Controls. Add(Me.txtShopP SI)
Me.grpSystemSer vices.Controls. Add(Me.labShopP si)
Me.grpSystemSer vices.Location = New System.Drawing. Point(432, 368)
Me.grpSystemSer vices.Name = "grpSystemServi ces"
Me.grpSystemSer vices.Size = New System.Drawing. Size(304, 152)
Me.grpSystemSer vices.TabIndex = 9
Me.grpSystemSer vices.TabStop = False
Me.grpSystemSer vices.Tag = ""
Me.grpSystemSer vices.Text = "System Services"
'
'chkHasCircuitB reakersYN
'
Me.chkHasCircui tBreakersYN.Loc ation = New System.Drawing. Point(120,
120)
Me.chkHasCircui tBreakersYN.Nam e = "chkHasCircuitB reakersYN"
Me.chkHasCircui tBreakersYN.Siz e = New System.Drawing. Size(176, 24)
Me.chkHasCircui tBreakersYN.Tab Index = 8
Me.chkHasCircui tBreakersYN.Tex t = "Circuit Brakers (Fuses default)"
'
'txtSystemAmps
'
Me.txtSystemAmp s.BackColor = System.Drawing. SystemColors.In fo
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtSy stemAmps,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtSy stemAmps,
MSDNTextboxVali dator.DataTypeC onstants.Int16T ype)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tSystemAmps,
"SystemAmps ")
Me.txtSystemAmp s.Location = New System.Drawing. Point(120, 96)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtSy stemAmps, "999")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtSy stemAmps, "0")
Me.txtSystemAmp s.Name = "txtSystemA mps"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtSystemAm ps, "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtSy stemAmps, False)
Me.txtSystemAmp s.TabIndex = 7
Me.txtSystemAmp s.Text = ""
Me.ToolTip1.Set ToolTip(Me.txtS ystemAmps, "Please enter an Integer
between 0 and 999.")
'
'labSystemAmps
'
Me.labSystemAmp s.Location = New System.Drawing. Point(8, 96)
Me.labSystemAmp s.Name = "labSystemA mps"
Me.labSystemAmp s.TabIndex = 6
Me.labSystemAmp s.Text = "System Amps"
'
'cboSystemPhase
'
Me.cboSystemPha se.DropDownStyl e =
System.Windows. Forms.ComboBoxS tyle.DropDownLi st
Me.cboSystemPha se.Location = New System.Drawing. Point(120, 72)
Me.cboSystemPha se.Name = "cboSystemPhase "
Me.cboSystemPha se.Size = New System.Drawing. Size(121, 21)
Me.cboSystemPha se.TabIndex = 5
'
'labSystemPhase
'
Me.labSystemPha se.Location = New System.Drawing. Point(8, 72)
Me.labSystemPha se.Name = "labSystemPhase "
Me.labSystemPha se.TabIndex = 4
Me.labSystemPha se.Text = "System Phase:"
'
'cboSystemVolta ge
'
Me.cboSystemVol tage.DropDownSt yle =
System.Windows. Forms.ComboBoxS tyle.DropDownLi st
Me.cboSystemVol tage.Location = New System.Drawing. Point(120, 48)
Me.cboSystemVol tage.Name = "cboSystemVolta ge"
Me.cboSystemVol tage.Size = New System.Drawing. Size(72, 21)
Me.cboSystemVol tage.TabIndex = 3
'
'labSystemVolta ge
'
Me.labSystemVol tage.Location = New System.Drawing. Point(8, 48)
Me.labSystemVol tage.Name = "labSystemVolta ge"
Me.labSystemVol tage.TabIndex = 2
Me.labSystemVol tage.Text = "System Voltage:"
'
'txtShopPSI
'
Me.txtShopPSI.B ackColor = System.Drawing. SystemColors.In fo
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtSh opPSI,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtSh opPSI,
MSDNTextboxVali dator.DataTypeC onstants.Int16T ype)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tShopPSI, "ShipPSI")
Me.txtShopPSI.L ocation = New System.Drawing. Point(120, 24)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtSh opPSI, "999")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtSh opPSI, "0")
Me.txtShopPSI.N ame = "txtShopPSI "
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtShopPSI, "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtSh opPSI, False)
Me.txtShopPSI.T abIndex = 1
Me.txtShopPSI.T ag = "DataEntry"
Me.txtShopPSI.T ext = ""
Me.ToolTip1.Set ToolTip(Me.txtS hopPSI, "Please enter an Integer
between 0 and 999.")
'
'labShopPsi
'
Me.labShopPsi.L ocation = New System.Drawing. Point(8, 24)
Me.labShopPsi.N ame = "labShopPsi "
Me.labShopPsi.T abIndex = 0
Me.labShopPsi.T ag = "DataEntry"
Me.labShopPsi.T ext = "Shop PSI (80):"
'
'chkIsMasterYN
'
Me.chkIsMasterY N.Location = New System.Drawing. Point(744, 496)
Me.chkIsMasterY N.Name = "chkIsMaste rYN"
Me.chkIsMasterY N.Size = New System.Drawing. Size(160, 24)
Me.chkIsMasterY N.TabIndex = 14
Me.chkIsMasterY N.Tag = ""
Me.chkIsMasterY N.Text = "This Job is the Master"
'
'lblReferenceJo bNumber
'
Me.lblReference JobNumber.Borde rStyle =
System.Windows. Forms.BorderSty le.Fixed3D
Me.lblReference JobNumber.Locat ion = New System.Drawing. Point(120,
448)
Me.lblReference JobNumber.Name = "lblReferenceJo bNumber"
Me.lblReference JobNumber.TabIn dex = 9
Me.lblReference JobNumber.Tag = ""
'
'chkAllProcesse sAddedYN
'
Me.chkAllProces sesAddedYN.Enab led = False
Me.chkAllProces sesAddedYN.Loca tion = New System.Drawing. Point(744,
376)
Me.chkAllProces sesAddedYN.Name = "chkAllProcesse sAddedYN"
Me.chkAllProces sesAddedYN.Size = New System.Drawing. Size(160, 24)
Me.chkAllProces sesAddedYN.TabI ndex = 26
Me.chkAllProces sesAddedYN.Tag = ""
Me.chkAllProces sesAddedYN.Text = "All Processes Added"
'
'chkAllProcesse sConfiguredYN
'
Me.chkAllProces sesConfiguredYN .Enabled = False
Me.chkAllProces sesConfiguredYN .Location = New
System.Drawing. Point(744, 424)
Me.chkAllProces sesConfiguredYN .Name = "chkAllProcesse sConfiguredYN"
Me.chkAllProces sesConfiguredYN .Size = New System.Drawing. Size(160,
24)
Me.chkAllProces sesConfiguredYN .TabIndex = 27
Me.chkAllProces sesConfiguredYN .Tag = ""
Me.chkAllProces sesConfiguredYN .Text = "All Processes Configured"
'
'chkArchive
'
Me.chkArchive.L ocation = New System.Drawing. Point(744, 520)
Me.chkArchive.N ame = "chkArchive "
Me.chkArchive.S ize = New System.Drawing. Size(160, 24)
Me.chkArchive.T abIndex = 28
Me.chkArchive.T ag = ""
Me.chkArchive.T ext = "Archive (hide)"
'
'txtCustomerNam e
'
Me.txtCustomerN ame.BackColor = System.Drawing. SystemColors.In fo
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtCu stomerName,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtCu stomerName,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tCustomerName,
"CustomerNa me")
Me.txtCustomerN ame.Location = New System.Drawing. Point(120, 400)
Me.txtCustomerN ame.MaxLength = 36
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtCu stomerName, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtCu stomerName, "")
Me.txtCustomerN ame.Name = "txtCustomerNam e"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtCustomer Name, "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtCu stomerName, False)
Me.txtCustomerN ame.Size = New System.Drawing. Size(200, 20)
Me.txtCustomerN ame.TabIndex = 35
Me.txtCustomerN ame.Tag = ""
Me.txtCustomerN ame.Text = ""
Me.ToolTip1.Set ToolTip(Me.txtC ustomerName, "Please enter a maximum of
36 letters.")
'
'lblCountOfJobs
'
Me.lblCountOfJo bs.BorderStyle =
System.Windows. Forms.BorderSty le.Fixed3D
Me.lblCountOfJo bs.ForeColor = System.Drawing. SystemColors.Gr ayText
Me.lblCountOfJo bs.Location = New System.Drawing. Point(120, 328)
Me.lblCountOfJo bs.Name = "lblCountOfJobs "
Me.lblCountOfJo bs.Size = New System.Drawing. Size(100, 16)
Me.lblCountOfJo bs.TabIndex = 33
'
'labTotalJobs
'
Me.labTotalJobs .Location = New System.Drawing. Point(8, 328)
Me.labTotalJobs .Name = "labTotalJo bs"
Me.labTotalJobs .Size = New System.Drawing. Size(100, 16)
Me.labTotalJobs .TabIndex = 32
Me.labTotalJobs .Text = "Total Jobs:"
'
'chkAllTasksAdd edYN
'
Me.chkAllTasksA ddedYN.Enabled = False
Me.chkAllTasksA ddedYN.Location = New System.Drawing. Point(744, 400)
Me.chkAllTasksA ddedYN.Name = "chkAllTasksAdd edYN"
Me.chkAllTasksA ddedYN.Size = New System.Drawing. Size(160, 24)
Me.chkAllTasksA ddedYN.TabIndex = 34
Me.chkAllTasksA ddedYN.Text = "All Tasks Added"
'
'MsdnTextboxVal idator1
'
Me.MsdnTextboxV alidator1.Displ ayControl = Nothing
Me.MsdnTextboxV alidator1.Error Provider = Me.ErrorProvide r1
Me.MsdnTextboxV alidator1.Inval idBackColor =
System.Drawing. Color.FromArgb( CType(192, Byte), CType(192, Byte),
CType(255, Byte))
Me.MsdnTextboxV alidator1.Toolt ipProvider = Nothing
'
'ErrorProvider1
'
Me.ErrorProvide r1.ContainerCon trol = Me
'
'txtEditedBy
'
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtEd itedBy,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtEd itedBy,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tEditedBy, "")
Me.txtEditedBy. Location = New System.Drawing. Point(120, 552)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtEd itedBy, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtEd itedBy, "")
Me.txtEditedBy. Name = "txtEditedB y"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtEditedBy , "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtEd itedBy, False)
Me.txtEditedBy. TabIndex = 72
Me.txtEditedBy. Tag = "RecordDoc"
Me.txtEditedBy. Text = ""
'
'txtEditedOn
'
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtEd itedOn,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtEd itedOn,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tEditedOn, "")
Me.txtEditedOn. Location = New System.Drawing. Point(120, 528)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtEd itedOn, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtEd itedOn, "")
Me.txtEditedOn. Name = "txtEditedO n"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtEditedOn , "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtEd itedOn, False)
Me.txtEditedOn. Size = New System.Drawing. Size(150, 20)
Me.txtEditedOn. TabIndex = 70
Me.txtEditedOn. Tag = "RecordDoc"
Me.txtEditedOn. Text = ""
'
'txtCreatedBy
'
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtCr eatedBy,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtCr eatedBy,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tCreatedBy, "")
Me.txtCreatedBy .Location = New System.Drawing. Point(120, 504)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtCr eatedBy, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtCr eatedBy, "")
Me.txtCreatedBy .Name = "txtCreated By"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtCreatedB y, "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtCr eatedBy, False)
Me.txtCreatedBy .TabIndex = 68
Me.txtCreatedBy .Tag = "RecordDoc"
Me.txtCreatedBy .Text = ""
'
'txtCreatedOn
'
Me.MsdnTextboxV alidator1.SetCu stomValidationE nabled(Me.txtCr eatedOn,
True)
Me.MsdnTextboxV alidator1.SetDa taType(Me.txtCr eatedOn,
MSDNTextboxVali dator.DataTypeC onstants.String Type)
Me.MsdnTextboxV alidator1.SetDi splayName(Me.tx tCreatedOn, "")
Me.txtCreatedOn .Location = New System.Drawing. Point(120, 480)
Me.MsdnTextboxV alidator1.SetMa xValue(Me.txtCr eatedOn, "")
Me.MsdnTextboxV alidator1.SetMi nValue(Me.txtCr eatedOn, "")
Me.txtCreatedOn .Name = "txtCreated On"
Me.MsdnTextboxV alidator1.SetRe gularExpression (Me.txtCreatedO n, "")
Me.MsdnTextboxV alidator1.SetRe quired(Me.txtCr eatedOn, False)
Me.txtCreatedOn .Size = New System.Drawing. Size(150, 20)
Me.txtCreatedOn .TabIndex = 66
Me.txtCreatedOn .Tag = "RecordDoc"
Me.txtCreatedOn .Text = ""
'
'lblCountOfConf igured
'
Me.lblCountOfCo nfigured.Border Style =
System.Windows. Forms.BorderSty le.Fixed3D
Me.lblCountOfCo nfigured.ForeCo lor =
System.Drawing. SystemColors.Gr ayText
Me.lblCountOfCo nfigured.Locati on = New System.Drawing. Point(352, 328)
Me.lblCountOfCo nfigured.Name = "lblCountOfConf igured"
Me.lblCountOfCo nfigured.Size = New System.Drawing. Size(100, 16)
Me.lblCountOfCo nfigured.TabInd ex = 37
'
'labTotalConfig ured
'
Me.labTotalConf igured.Location = New System.Drawing. Point(240, 328)
Me.labTotalConf igured.Name = "labTotalConfig ured"
Me.labTotalConf igured.Size = New System.Drawing. Size(100, 16)
Me.labTotalConf igured.TabIndex = 36
Me.labTotalConf igured.Text = "Total Configured:"
'
'Button1
'
Me.Button1.Loca tion = New System.Drawing. Point(320, 480)
Me.Button1.Name = "Button1"
Me.Button1.TabI ndex = 38
Me.Button1.Text = "Button1"
'
'Button2
'
Me.Button2.Loca tion = New System.Drawing. Point(320, 512)
Me.Button2.Name = "Button2"
Me.Button2.TabI ndex = 39
Me.Button2.Text = "Button2"
'
'btnExit
'
Me.btnExit.Loca tion = New System.Drawing. Point(848, 584)
Me.btnExit.Name = "btnExit"
Me.btnExit.TabI ndex = 63
Me.btnExit.Text = "Close"
'
'labEditedBy
'
Me.labEditedBy. Location = New System.Drawing. Point(8, 552)
Me.labEditedBy. Name = "labEditedB y"
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 = "labEditedO n"
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 = "labCreated By"
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 = "labCreated On"
Me.labCreatedOn .TabIndex = 65
Me.labCreatedOn .Tag = "RecordDoc"
Me.labCreatedOn .Text = "Created On:"
'
'DataGrid1
'
Me.DataGrid1.Da taMember = ""
Me.DataGrid1.He aderForeColor =
System.Drawing. SystemColors.Co ntrolText
Me.DataGrid1.Lo cation = New System.Drawing. Point(8, 120)
Me.DataGrid1.Na me = "DataGrid1"
Me.DataGrid1.Si ze = New System.Drawing. Size(920, 200)
Me.DataGrid1.Ta bIndex = 0
'
'f010Jobs
'
Me.AutoScaleBas eSize = 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.txtCreatedB y)
Me.Controls.Add (Me.txtCreatedO n)
Me.Controls.Add (Me.labEditedBy )
Me.Controls.Add (Me.labEditedOn )
Me.Controls.Add (Me.labCreatedB y)
Me.Controls.Add (Me.labCreatedO n)
Me.Controls.Add (Me.DataGrid1)
Me.Controls.Add (Me.btnExit)
Me.Controls.Add (Me.Button2)
Me.Controls.Add (Me.Button1)
Me.Controls.Add (Me.lblCountOfC onfigured)
Me.Controls.Add (Me.labTotalCon figured)
Me.Controls.Add (Me.txtCustomer Name)
Me.Controls.Add (Me.chkAllTasks AddedYN)
Me.Controls.Add (Me.lblCountOfJ obs)
Me.Controls.Add (Me.labTotalJob s)
Me.Controls.Add (Me.chkArchive)
Me.Controls.Add (Me.chkAllProce ssesConfiguredY N)
Me.Controls.Add (Me.chkAllProce ssesAddedYN)
Me.Controls.Add (Me.lblReferenc eJobNumber)
Me.Controls.Add (Me.chkIsMaster YN)
Me.Controls.Add (Me.grpSystemSe rvices)
Me.Controls.Add (Me.txtUserNote )
Me.Controls.Add (Me.txtJobNumbe r)
Me.Controls.Add (Me.lblpkJobId)
Me.Controls.Add (Me.labJobId)
Me.Controls.Add (Me.chkComplete dYN)
Me.Controls.Add (Me.chkApproved YN)
Me.Controls.Add (Me.labUserNote )
Me.Controls.Add (Me.labReferenc eJobNumber)
Me.Controls.Add (Me.txtJobDescr iption)
Me.Controls.Add (Me.labJobDescr iption)
Me.Controls.Add (Me.labCustomer Name)
Me.Controls.Add (Me.labJobNumbe r)
Me.Name = "f010Jobs"
Me.Text = "f010Jobs"
Me.grpSystemSer vices.ResumeLay out(False)
CType(Me.DataGr id1,
System.Componen tModel.ISupport Initialize).End Init()
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 BindingManagerB ase
'ComboBox Control
Private _bStillPopulati ngCboVoltage As Boolean = True
Private _bStillPopulati ngCboPhase As Boolean = True
Protected Sub DataGrid1_Curre ntCellChanged(B yVal sender As Object,
ByVal e As System.EventArg s) Handles DataGrid1.Curre ntCellChanged
_bmb.Position = DataGrid1.Curre ntCell.RowNumbe r
End Sub
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me._dataSet1 = New CLIP.dsTables
_currentTable = "tbl010Job"
_dt = _dataSet1.tbl01 0Job
Call FillDataSet()
Call SetBindings()
End Sub
Private Sub FillDataSet()
DAL.sqlConn.Ope n()
DAL.da104Voltag e_Cbo.Fill(_dat aSet1, "lkp104Voltage" )
DAL.da102Phase_ Cbo.Fill(_dataS et1, "lkp102Phas e")
DAL.da010JobFrm .Fill(_dataSet1 , "tbl010Job" )
DAL.sqlConn.Clo se()
DAL.sqlConn.Clo se()
End Sub
Private Sub SetBindings()
'[ComboBox]
Me.cboSystemVol tage.DataSource = _dataSet1
Me.cboSystemVol tage.DisplayMem ber = "lkp104Voltage. Voltage"
Me.cboSystemVol tage.ValueMembe r = "lkp104Voltage. pkVoltageId"
Me.cboSystemPha se.DataSource = _dataSet1
Me.cboSystemPha se.DisplayMembe r = "lkp102Phase.Ph ase"
Me.cboSystemPha se.ValueMember = "lkp102Phase.pk PhaseId"
'[DataGrid]
Me.DataGrid1.Da taMember = "tbl010Job"
Me.DataGrid1.Da taSource = _dataSet1
'[Controls]
Me.lblpkJobId.D ataBindings.Add ("Text", _dt, "pkJobId")
Me.txtJobNumber .DataBindings.A dd("Text", _dt, "JobNumber" )
Me.txtCustomerN ame.DataBinding s.Add("Text", _dt, "CustomerNa me")
Me.txtJobDescri ption.DataBindi ngs.Add("Text", _dt, "JobDescription ")
Me.lblReference JobNumber.DataB indings.Add("Te xt", _dt,
"ReferenceJobNu mber")
Me.txtShopPSI.D ataBindings.Add ("Text", _dt, "ShopPsi")
Me.cboSystemVol tage.DataBindin gs.Add("Selecte dValue", _dt,
"SystemVoltage" )
Me.cboSystemPha se.DataBindings .Add("SelectedV alue", _dt,
"SystemPhas e")
Me.txtSystemAmp s.DataBindings. Add("Text", _dt, "SystemAmps ")
Me.chkHasCircui tBreakersYN.Dat aBindings.Add(" Checked", _dt,
"HasCircuitBrea kersYN")
Me.chkAllProces sesAddedYN.Data Bindings.Add("C hecked", _dt,
"AllProcessesAd dedYN")
Me.chkAllTasksA ddedYN.DataBind ings.Add("Check ed", _dt,
"AllTasksAddedY N")
Me.chkAllProces sesConfiguredYN .DataBindings.A dd("Checked", _dt,
"AllProcessesCo nfiguredYN")
Me.chkApprovedY N.DataBindings. Add("Checked", _dt, "ApprovedYN ")
Me.chkCompleted YN.DataBindings .Add("Checked", _dt, "CompletedY N")
Me.chkIsMasterY N.DataBindings. Add("Checked", _dt, "IsMasterYN ")
Me.chkArchive.D ataBindings.Add ("Checked", _dt, "Archive")
Me.txtUserNote. DataBindings.Ad d("Text", _dt, "jcUserNote ")
Me.txtCreatedOn .DataBindings.A dd("Text", _dt, "jcCreatedO n")
Me.txtCreatedBy .DataBindings.A dd("Text", _dt, "jcCreatedB y")
Me.txtEditedOn. DataBindings.Ad d("Text", _dt, "jcEditedOn ")
Me.txtEditedBy. DataBindings.Ad d("Text", _dt, "jcEditedBy ")
'[BindingContext]
_bmb = Me.BindingConte xt(_dt)
_bmb.Position = 0
End Sub
Private Sub btnExit_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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_Gene ral_CP1_CI_AS NOT NULL
CONSTRAINT [DF_tbl010JobCus tomer_pkJobId] DEFAULT (newid()),
[JobNumber] [varchar] (7) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NOT
NULL ,
[CustomerName] [varchar] (25) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NOT
NULL ,
[JobDescription] [varchar] (75) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS
NOT NULL ,
[ReferenceJobNum ber] [varchar] (7) COLLATE
SQL_Latin1_Gene ral_CP1_CI_AS NULL ,
[ShopPsi] [tinyint] NULL ,
[SystemVoltage] [int] NULL ,
[SystemPhase] [int] NULL ,
[SystemAmps] [varchar] (3) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL ,
[HasCircuitBreak ersYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_Ha sCircuitBreaker sYN] DEFAULT (0),
[AllProcessesAdd edYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_Al lProcessesPrese ntYN] DEFAULT (0),
[AllProcessesCon figuredYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_Al lChildConfigsCo mpleteYN] DEFAULT (0),
[ApprovedYN] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_Ap provedYN]
DEFAULT (0),
[CompletedYN] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_Co mpletedYN]
DEFAULT (0),
[IsMasterYN] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_Is MasterYN]
DEFAULT (0),
[Archive] [bit] NOT NULL CONSTRAINT [DF_tbl010Job_AR CHIVE] DEFAULT
(0),
[jcUserNote] [varchar] (100) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NOT
NULL ,
[jcCreatedOn] [smalldatetime] NOT NULL ,
[jcCreatedBy] [varchar] (25) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NOT
NULL ,
[jcEditedOn] [smalldatetime] NOT NULL ,
[jcEditedBy] [varchar] (25) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NOT
NULL ,
[jcrowversion] [timestamp] NOT NULL ,
[AllTasksAddedYN] [bit] NOT NULL CONSTRAINT
[DF_tbl010Job_Al lTasksAddedYN] 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_Gene ral_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_Gene ral_CP1_CI_AS NOT NULL
,
[Ord] [tinyint] NOT NULL CONSTRAINT [DF_lkp104Voltag e_ord] DEFAULT
(0),
[Hide] [bit] NOT NULL CONSTRAINT [DF_lkp104Voltag e_hide] DEFAULT (0),
CONSTRAINT [PK_lkp104Voltag e] PRIMARY KEY CLUSTERED
(
[pkVoltageId]
) ON [PRIMARY]
) ON [PRIMARY]
GO
//
=============== =======
3.) Here is sample data
\\
pkJobId,JobNumb er,CustomerName ,JobDescription ,ReferenceJobNu mber,ShopPsi,Sy stemVoltage,Sys temPhase,System Amps,HasCircuit BreakersYN,AllP rocessesAddedYN ,AllProcessesCo nfiguredYN,Appr ovedYN,Complete dYN,IsMasterYN, Archive,jcUserN ote,jcCreatedOn ,jcCreatedBy,jc EditedOn,jcEdit edBy,jcrowversi on,AllTasksAdde dYN
166aba12-e302-4e1e-9723-299ed9a40aad,P1 161,Plastech,DC X RH/LH A Piller
Cap
Clip,,75,2,3,10 0,TRUE,FALSE,FA LSE,FALSE,FALSE ,FALSE,FALSE,,9/1/2005,dbuchanan, 9/6/2005,dbuchanan, 00000000000163D E,FALSE
582E2CC9-BCDF-49C4-ACE1-3697DEF54A53,F1 136,Frax,To this do
that,,,,,,FALSE ,FALSE,FALSE,FA LSE,FALSE,FALSE ,FALSE,,9/12/2005,db,9/12/2005,db,0000000 00001641C,FALSE
5F8E9720-4C24-47AF-B7E1-7168784BE30A,G1 137,Graxton,Som ething
else,,,,,,FALSE ,FALSE,FALSE,FA LSE,FALSE,FALSE ,FALSE,,9/12/2005,db,9/12/2005,db,0000000 00001641E,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 InitializeCompo nent()
End Sub
'[Initialize class component]
Private Sub InitializeCompo nent()
'[Add Tables to the DataSet]
Me.tbl010Job = Me.Tables.Add(" tbl010Job")
Me.lkp102Phase = Me.Tables.Add(" lkp102Phase")
Me.lkp104Voltag e = Me.Tables.Add(" lkp104Voltage")
'[Add Columns to the DataTables]
' tbl010Job
Dim pkJobId As DataColumn = Me.tbl010Job.Co lumns.Add("pkJo bId",
GetType(String) ) : pkJobId.MaxLeng th = 36 : pkJobId.AllowDB Null = False
Dim JobNumber As DataColumn =
Me.tbl010Job.Co lumns.Add("JobN umber", GetType(String) ) :
JobNumber.MaxLe ngth = 7 : JobNumber.Allow DBNull = False
Dim CustomerName As DataColumn =
Me.tbl010Job.Co lumns.Add("Cust omerName", GetType(String) ) :
CustomerName.Ma xLength = 25 : CustomerName.Al lowDBNull = False
Dim JobDescription As DataColumn =
Me.tbl010Job.Co lumns.Add("JobD escription", GetType(String) ) :
JobDescription. MaxLength = 75 : JobDescription. AllowDBNull = False
Dim ReferenceJobNum ber As DataColumn =
Me.tbl010Job.Co lumns.Add("Refe renceJobNumber" , GetType(String) ) :
ReferenceJobNum ber.MaxLength = 7 : ReferenceJobNum ber.AllowDBNull =
True
Dim ShopPsi As DataColumn = Me.tbl010Job.Co lumns.Add("Shop Psi",
GetType(Byte)) : ShopPsi.AllowDB Null = True 'ShopPsi.Defaul tValue = 80
'Would this send the value to a new row? 'TODO - dsTables -
DatsColumn.Defa ultValue
Dim SystemVoltage As DataColumn =
Me.tbl010Job.Co lumns.Add("Syst emVoltage", GetType(Int32)) :
SystemVoltage.A llowDBNull = True
Dim SystemPhase As DataColumn =
Me.tbl010Job.Co lumns.Add("Syst emPhase", GetType(Int32)) :
SystemPhase.All owDBNull = True
Dim SystemAmps As DataColumn =
Me.tbl010Job.Co lumns.Add("Syst emAmps", GetType(String) ) :
SystemAmps.MaxL ength = 3 : SystemAmps.Allo wDBNull = True
Dim HasCircuitBreak ersYN As DataColumn =
Me.tbl010Job.Co lumns.Add("HasC ircuitBreakersY N", GetType(Boolean )) :
HasCircuitBreak ersYN.AllowDBNu ll = False
Dim AllProcessesAdd edYN As DataColumn =
Me.tbl010Job.Co lumns.Add("AllP rocessesAddedYN ", GetType(Boolean )) :
AllProcessesAdd edYN.AllowDBNul l = False
Dim AllTasksAddedYN As DataColumn =
Me.tbl010Job.Co lumns.Add("AllT asksAddedYN", GetType(Boolean )) :
AllTasksAddedYN .AllowDBNull = False
Dim AllProcessesCon figuredYN As DataColumn =
Me.tbl010Job.Co lumns.Add("AllP rocessesConfigu redYN", GetType(Boolean ))
: AllProcessesCon figuredYN.Allow DBNull = False
Dim ApprovedYN As DataColumn =
Me.tbl010Job.Co lumns.Add("Appr ovedYN", GetType(Boolean )) :
ApprovedYN.Allo wDBNull = False
Dim CompletedYN As DataColumn =
Me.tbl010Job.Co lumns.Add("Comp letedYN", GetType(Boolean )) :
CompletedYN.All owDBNull = False
Dim IsMasterYN As DataColumn =
Me.tbl010Job.Co lumns.Add("IsMa sterYN", GetType(Boolean )) :
IsMasterYN.Allo wDBNull = False
Dim Archive As DataColumn = Me.tbl010Job.Co lumns.Add("Arch ive",
GetType(Boolean )) : Archive.AllowDB Null = False
Dim jcUserNote As DataColumn = Me.tbl010Job.Co lumns.Add("jcUs erNote",
GetType(String) ) : jcUserNote.MaxL ength = 100 : jcUserNote.Allo wDBNull
= False
Dim jcCreatedOn As DataColumn =
Me.tbl010Job.Co lumns.Add("jcCr eatedOn", GetType(DateTim e)) :
jcCreatedOn.All owDBNull = False
Dim jcCreatedBy As DataColumn =
Me.tbl010Job.Co lumns.Add("jcCr eatedBy", GetType(String) ) :
jcCreatedBy.Max Length = 25 : jcCreatedBy.All owDBNull = False
Dim jcEditedOn As DataColumn =
Me.tbl010Job.Co lumns.Add("jcEd itedOn", GetType(DateTim e)) :
jcEditedOn.Allo wDBNull = False
Dim jcEditedBy As DataColumn = Me.tbl010Job.Co lumns.Add("jcEd itedBy",
GetType(String) ) : jcEditedBy.MaxL ength = 25 : jcEditedBy.Allo wDBNull =
False
Dim jcrowversion As DataColumn =
Me.tbl010Job.Co lumns.Add("jcro wversion", GetType(Byte()) ) :
jcrowversion.Al lowDBNull = True
' lkp102Phase
Dim pkPhaseId As DataColumn = Me.lkp102Phase. Columns.Add("pk PhaseId",
GetType(Int32)) : pkPhaseId.Allow DBNull = False
Dim Phase As DataColumn = Me.lkp102Phase. Columns.Add("Ph ase",
GetType(String) ) : Phase.MaxLength = 50 : Phase.AllowDBNu ll = False
Dim Ord102 As DataColumn = Me.lkp102Phase. Columns.Add("Or d",
GetType(Byte)) : Ord102.AllowDBN ull = False
Dim Hide102 As DataColumn = Me.lkp102Phase. Columns.Add("Hi de",
GetType(Boolean )) : Hide102.AllowDB Null = False
' lkp104Voltage
Dim pkVoltageId As DataColumn =
Me.lkp104Voltag e.Columns.Add(" pkVoltageId", GetType(Int32)) :
pkVoltageId.All owDBNull = False
Dim Voltage As DataColumn = Me.lkp104Voltag e.Columns.Add(" Voltage",
GetType(String) ) : Voltage.MaxLeng th = 3 : Voltage.AllowDB Null = False
Dim Ord104 As DataColumn = Me.lkp104Voltag e.Columns.Add(" Ord",
GetType(Byte)) : Ord104.AllowDBN ull = False
Dim Hide104 As DataColumn =
Me.lkp104Voltag e.Columns.Add(" Hide", GetType(Boolean )) :
Hide104.AllowDB Null = False
'[Simple PK Constraints - (one line)]
tbl010Job.Prima ryKey = New DataColumn()
{tbl010Job.Colu mns("pkJobID")}
lkp102Phase.Pri maryKey = New DataColumn()
{lkp102Phase.Co lumns("pkPhaseI d")}
lkp104Voltage.P rimaryKey = New DataColumn()
{lkp104Voltage. Columns("pkVolt ageId")}
End Sub
End Class
//
=============== =======
5.) Here is the Data Access code (DataAccess.vb)
\\
Imports System.Data.Sql Client
Imports System.Data.Com mon
Imports System.Configur ation
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 DataAccessLkpAd min 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_selVol tPhase'
'For ComboBoxes
Friend da102Phase_Cbo As New SqlDataAdapter ' for select only
Friend da104Voltage_Cb o As New SqlDataAdapter ' for select only
'=== [Commands] =============== ===============
Private Cmd010JobFrm_Se l As New SqlCommand
Private Cmd010JobFrm_In s As New SqlCommand
Private Cmd010JobFrm_Up d As New SqlCommand
Private Cmd010JobFrm_De l As New SqlCommand
'=== [Commands - ComboBoxes] =============== =========
Private Cmd102Phase_Sel As New SqlCommand
Private Cmd104Voltage_S el As New SqlCommand
#End Region
'[Constructor]
Public Sub New()
MyBase.New()
Call InitializeCompo nent()
End Sub
#Region " InitializeCompo nent - [ Instantiate (Connection,
DataAdapters, Commands), Give value (Connection String)] "
<System.Diagnos tics.DebuggerSt epThrough()> _
Private Sub InitializeCompo nent()
'=== [Connection String] =============== =========
Dim connectionStrin g As String
connectionStrin g =
ConfigurationSe ttings.AppSetti ngs("Connection String")
Me.sqlConn.Conn ectionString = connectionStrin g
'=== [Set Cmds - Forms] =============== =======
With da010JobFrm
.SelectCommand = Cmd010JobFrm_Se l
.InsertCommand = Cmd010JobFrm_In s
.UpdateCommand = Cmd010JobFrm_Up d
.DeleteCommand = Cmd010JobFrm_De l
End With
'=== [Set Cmds - ComboBoxes] =============== =
da102Phase_Cbo. SelectCommand = Cmd102Phase_Sel
da104Voltage_Cb o.SelectCommand = Cmd104Voltage_S el
'### da010JobFrm ############### ###
'Select
With Cmd010JobFrm_Se l
.CommandType = CommandType.Sto redProcedure
.CommandText = "usp_Job_sel_Vo ltPhase"
.Connection = sqlConn
With Cmd010JobFrm_Se l.Parameters
.Add(New SqlParameter("@ RETURN_VALUE", SqlDbType.Int, 4,
ParameterDirect ion.ReturnValue , False, CType(0, Byte), CType(0, Byte),
"", DataRowVersion. Current, Nothing))
End With
End With
'%%% da102Phase_Cbo %%%%%%%%%%%%%%% %%
'Select
With Cmd102Phase_Sel
.CommandType = CommandType.Sto redProcedure
.CommandText = "usp_102Phase_s el_cbo"
.Connection = sqlConn
With Cmd102Phase_Sel .Parameters
.Add(New SqlParameter("@ RETURN_VALUE", SqlDbType.Int, 4,
ParameterDirect ion.ReturnValue , False, CType(0, Byte), CType(0, Byte),
"", DataRowVersion. Current, Nothing))
End With
End With
'%%% da104Voltage_Cb o %%%%%%%%%%%%%%% %
'Select
With Cmd104Voltage_S el
.CommandType = CommandType.Sto redProcedure
.CommandText = "usp_104Voltage _sel_cbo"
.Connection = sqlConn
With Cmd104Voltage_S el.Parameters
.Add(New SqlParameter("@ RETURN_VALUE", SqlDbType.Int, 4,
ParameterDirect ion.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_Vo ltPhase"
\\
CREATE PROCEDURE dbo.usp_Job_sel _VoltPhase
AS SET NOCOUNT ON;
SELECT
j.pkJobId,
j.JobNumber,
j.CustomerName,
j.JobDescriptio n,
j.ShopPsi,
j.SystemVoltage ,
v.Voltage,
j.SystemPhase,
ph.Phase,
j.SystemAmps,
j.HasCircuitBre akersYN,
j.ReferenceJobN umber,
j.AllProcessesA ddedYN,
j.AllProcessesC onfiguredYN,
j.AllTasksAdded YN,
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_s el_cbo"
\\
CREATE PROCEDURE dbo.usp_102Phas e_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_104Volt age_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