473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DataGrid using a table not a DataSet

Leo
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.EventArgs) Handles MyBase.Loa
If Not (Page.IsPostBack) The

'Sequenc
Dim Sequence As DataColumn = New DataColum
With Sequenc
.DataType = System.Type.GetType("System.Int32"
.ColumnName = "Sequence
.AllowDBNull = Fals
.ReadOnly = Tru
.AutoIncrement = Tru
End Wit
tblJobItems.Columns.Add(Sequence

'Quantit
Dim Quantity As DataColumn = New DataColum
With Quantit
.DataType = System.Type.GetType("System.Int32"
.ColumnName = "Quantity
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Columns.Add(Quantity

'FamilyTyp
Dim FamilyType As DataColumn = New DataColum
With FamilyTyp
.DataType = System.Type.GetType("System.String"
.ColumnName = "FamilyType
.ReadOnly = Fals
.AutoIncrement = Fals
.Caption = "Truss Type
End Wit
tblJobItems.Columns.Add(FamilyType

' Over All Lengt
Dim OAL As DataColumn = New DataColum
With OA
.DataType = System.Type.GetType("System.String"
.ColumnName = "OALen
.ReadOnly = Fals
.AutoIncrement = Fals
.Caption = "Over all Length
End Wit
tblJobItems.Columns.Add(OAL

'Hee
Dim Heel As DataColumn = New DataColum
With Hee
.DataType = System.Type.GetType("System.String"
.ColumnName = "Heel
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Columns.Add(Heel

'Item Descriptio
Dim Description As DataColumn = New DataColum
With Descriptio
.DataType = System.Type.GetType("System.String"
.ColumnName = "Description
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Columns.Add(Description

'Pitc
Dim Pitch As DataColumn = New DataColum
With Pitc
.DataType = System.Type.GetType("System.String"
.ColumnName = "Pitch
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Columns.Add(Pitch

'LOverHang
Dim LOverHang As DataColumn = New DataColum
With LOverHan
.DataType = System.Type.GetType("System.String"
.ColumnName = "LOH
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Columns.Add(LOverHang

'ROverHan
Dim ROverHang As DataColumn = New DataColum
With ROverHan
.DataType = System.Type.GetType("System.String"
.ColumnName = "ROH
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Columns.Add(ROverHang

'LCan
Dim LCant As DataColumn = New DataColum
With LCan
.DataType = System.Type.GetType("System.String"
.ColumnName = "LCant
.ReadOnly = Fals
.AutoIncrement = Fals
End Wit
tblJobItems.Columns.Add(LCant

'RCant
Dim RCant As DataColumn = New DataColumn
With RCant
.DataType = System.Type.GetType("System.String")
.ColumnName = "RCant"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Columns.Add(RCant)

'BearingSize
Dim BearingSize As DataColumn = New DataColumn
With BearingSize
.DataType = System.Type.GetType("System.String")
.ColumnName = "BearingSize"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Columns.Add(BearingSize)

'SpecialNotes
Dim SpecialNotes As DataColumn = New DataColumn
With SpecialNotes
.DataType = System.Type.GetType("System.String")
.ColumnName = "SpecialNotes"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Columns.Add(SpecialNotes)
' Create an array for DataColumn objects.
Dim keys(0) As DataColumn
keys(0) = Sequence

Dim PrimaryKeyColumns(0) As DataColumn
PrimaryKeyColumns(0) = tblJobItems.Columns("Sequence")
tblJobItems.PrimaryKey = PrimaryKeyColumns
End If
DataGrid1.DataSource = tblJobItems
DataGrid1.DataBind()

End Sub

Private Sub btnADDTrussItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnADDTrussItem.Click

'Insert new row into the dataset table
Dim dr As DataRow = tblJobItems.NewRow()
dr("OALen") = tbOAL.Text
dr("Heel") = ddlHeel.SelectedValue
tblJobItems.Rows.Add(dr)
'Refresh the grid
DataGrid1.EditItemIndex = -1
End Sub
Nov 18 '05 #1
0 1343

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Morné | last post by:
Hi how do I validate a text value in a datagrid e.g. the user is only allowed to type in a Y or a N. I specifically have a problem with using the PropertyDescriptorCollection. I get the...
3
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called...
2
by: Wing | last post by:
Hi all, I am using Microsoft Visual Studio .NET 2003 to program my code. I have following question. I am trying to adding a few bound columns which from a dataset that containing 2 tables to...
6
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
7
by: Juan Romero | last post by:
Hey guys, please HELP I am going nuts with the datagrid control. I cannot get the damn control to refresh. I am using soap to get information from a web service. I have an XML writer output...
5
by: Genojoe | last post by:
I am using code from Help with two exceptions. (1) I increased the number of sample rows from 3 to 20, and (2) I anchored the datagrid to bottom of form so that I can change the size of the grid by...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.