Thanks for the Help in Advance!
I am a beginner in VB.Net. I am trying to create a form which is displayed in a email for our customers to fill in a Request for quote. I would like them to type data into fields and have it added to the Datagrid
I am constantly getting the error Column 'OALen' does not belong to table .
Any Ideas
Public tblJobItems As New DataTabl
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Loa
If Not (Page.IsPostBac k) The
'Sequenc
Dim Sequence As DataColumn = New DataColum
With Sequenc
.DataType = System.Type.Get Type("System.In t32"
.ColumnName = "Sequence
.AllowDBNull = Fals
.ReadOnly = Tru
.AutoIncrement = Tru
End Wit
tblJobItems.Col umns.Add(Sequen ce
'Quantit
Dim Quantity As DataColumn = New DataColum
With Quantit
.DataType = System.Type.Get Type("System.In t32"
.ColumnName = "Quantity
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Col umns.Add(Quanti ty
'FamilyTyp
Dim FamilyType As DataColumn = New DataColum
With FamilyTyp
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "FamilyType
.ReadOnly = Fals
.AutoIncrement = Fals
.Caption = "Truss Type
End Wit
tblJobItems.Col umns.Add(Family Type
' Over All Lengt
Dim OAL As DataColumn = New DataColum
With OA
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "OALen
.ReadOnly = Fals
.AutoIncrement = Fals
.Caption = "Over all Length
End Wit
tblJobItems.Col umns.Add(OAL
'Hee
Dim Heel As DataColumn = New DataColum
With Hee
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "Heel
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Col umns.Add(Heel
'Item Descriptio
Dim Description As DataColumn = New DataColum
With Descriptio
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "Descriptio n
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Col umns.Add(Descri ption
'Pitc
Dim Pitch As DataColumn = New DataColum
With Pitc
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "Pitch
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Col umns.Add(Pitch
'LOverHang
Dim LOverHang As DataColumn = New DataColum
With LOverHan
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "LOH
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Col umns.Add(LOverH ang
'ROverHan
Dim ROverHang As DataColumn = New DataColum
With ROverHan
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "ROH
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Col umns.Add(ROverH ang
'LCan
Dim LCant As DataColumn = New DataColum
With LCan
.DataType = System.Type.Get Type("System.St ring"
.ColumnName = "LCant
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Col umns.Add(LCant
'RCant
Dim RCant As DataColumn = New DataColumn
With RCant
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "RCant"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(RCant)
'BearingSize
Dim BearingSize As DataColumn = New DataColumn
With BearingSize
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "BearingSiz e"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(Bearin gSize)
'SpecialNotes
Dim SpecialNotes As DataColumn = New DataColumn
With SpecialNotes
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "SpecialNot es"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(Specia lNotes)
' Create an array for DataColumn objects.
Dim keys(0) As DataColumn
keys(0) = Sequence
Dim PrimaryKeyColum ns(0) As DataColumn
PrimaryKeyColum ns(0) = tblJobItems.Col umns("Sequence" )
tblJobItems.Pri maryKey = PrimaryKeyColum ns
End If
DataGrid1.DataS ource = tblJobItems
DataGrid1.DataB ind()
End Sub
Private Sub btnADDTrussItem _Click(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnADDTrussItem .Click
'Insert new row into the dataset table
Dim dr As DataRow = tblJobItems.New Row()
dr("OALen") = tbOAL.Text
dr("Heel") = ddlHeel.Selecte dValue
tblJobItems.Row s.Add(dr)
'Refresh the grid
DataGrid1.EditI temIndex = -1
End Sub