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 DataTable
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
If Not (Page.IsPostBac k) Then
'Sequence
Dim Sequence As DataColumn = New DataColumn
With Sequence
.DataType = System.Type.Get Type("System.In t32")
.ColumnName = "Sequence"
.AllowDBNull = False
.ReadOnly = True
.AutoIncrement = True
End With
tblJobItems.Col umns.Add(Sequen ce)
'Quantity
Dim Quantity As DataColumn = New DataColumn
With Quantity
.DataType = System.Type.Get Type("System.In t32")
.ColumnName = "Quantity"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(Quanti ty)
'FamilyType
Dim FamilyType As DataColumn = New DataColumn
With FamilyType
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "FamilyType "
.ReadOnly = False
.AutoIncrement = False
.Caption = "Truss Type"
End With
tblJobItems.Col umns.Add(Family Type)
' Over All Length
Dim OAL As DataColumn = New DataColumn
With OAL
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "OALen"
.ReadOnly = False
.AutoIncrement = False
.Caption = "Over all Length"
End With
tblJobItems.Col umns.Add(OAL)
'Heel
Dim Heel As DataColumn = New DataColumn
With Heel
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "Heel"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(Heel)
'Item Description
Dim Description As DataColumn = New DataColumn
With Description
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "Descriptio n"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(Descri ption)
'Pitch
Dim Pitch As DataColumn = New DataColumn
With Pitch
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "Pitch"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(Pitch)
'LOverHange
Dim LOverHang As DataColumn = New DataColumn
With LOverHang
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "LOH"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(LOverH ang)
'ROverHang
Dim ROverHang As DataColumn = New DataColumn
With ROverHang
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "ROH"
.ReadOnly = False
.AutoIncrement = False
End With
tblJobItems.Col umns.Add(ROverH ang)
'LCant
Dim LCant As DataColumn = New DataColumn
With LCant
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "LCant"
.ReadOnly = False
.AutoIncrement = False
End With
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 3 1611
Hi Leo
The reason might be the variable tblJobItems. Though you define as public, it will not persist through posting back. You might consider using ViewState to store it, like
Private tblJobItems As 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
'Build datatabl
Els
'Get table from ViewStat
tblJobItems = CType(ViewState ("tblJobItems") , DataTable
End I
DataGrid1.DataS ource = tblJobItem
DataGrid1.DataB ind(
End Su
Private Sub Page_Prerender( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.PreRende
'Save table back to ViewStat
ViewState("tblJ obItems") = tblJobItem
End Su
Hope this will help
Bin Song, MC
Hi Leo,
Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey http://msdn.microsoft.com/asp.net/whidbey/default.aspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jordan O'Hare |
last post by:
Hello Everyone,
I am after some help with the following:
I have a windows application that contains a list box and
two data grids. All three controls are binded to a dataset
that contains five tables, and three relations that I want
to take advantage of. Everything works fine however I want
to use the data grid table style editor to make...
|
by: kk |
last post by:
Have 2 problems, any help is appreciated.
Tab with Grids
--------------
BL - fetching data from DB ( 5 secs - 10 rows)
Grid Laod - 20 secs
Grid Paint on tab change - 20 secs
Problem: The data fetch only takes 5 secs, why does paint
and load take 40 secs in total.
|
by: Ann Morris |
last post by:
INTRODUCTION
One of the most powerful aspects of .NET and Windows Forms is data
binding. Data binding is the process of associating user interface
(UI) elements with a data source to generate a visual representation
of data. Two types of data binding are available for Windows Forms:
Simple Data Binding and Complex Data Binding.
Simple...
|
by: pmud |
last post by:
Hi,
I need to display columns in a data grid based on 7 different queries. Now I
have 32 questions:
1. Is it possble to have 1 single data adapter with 7 queries & 1 data set
or do I need to have a separate data adapter & a separate data set for each
select query?
If thats possible then how?
|
by: VMI |
last post by:
We have this huge application that's based on storing tons of data on a
dataTable. The only problem we're having is that storing LOTS of data (1
million records) into a datatable will slow down the system since all this
data will be stored in memory. The performance is really affected with this.
Since we don't really want to redesign...
| |
by: Hutty |
last post by:
I've looked around and have yet to find anything that would answer my
question regarding formating a column in a datagrid. My grid looks like
this as far as data"
AMHQCON|51300.01|-3147
The first two columns are pretty much text column, but subsequent columns
1-12 are numerical. I'm trying to get the thousand separator to work. Any...
|
by: pmud |
last post by:
Hi,
I have a web page (asp.net, code:c#). I havean html table with text boxes.
Based on the user input , records are displayed in the data grid below it.
Now the datagrid has a large no. of columns. & depending on what the user
enters, the data grid can grow very large. So to avoid scrolling the whole
page, I just want the data grid to be...
|
by: Kimberley Wiggins |
last post by:
Can someone please help me? I am still learning vb so this is fairly
new.
I have been chasing this problem for 3 days now and I think that I am
ready to give up. Does anyone know how to make my data grid display on
a tab control? I have a tab control with 2 tabs on it, one for the
data grid and the other for comments. I have tried...
|
by: Scottie_do |
last post by:
I have a 20meg in-memory stack-based array and I'd like to normalise in the
client's memory... then add foriegn keys, and display results on a datagrid.
I discovered that converting the stack to a datatable my memory utilisation
increases to 120 megs. (lots of overhead)
Couple of questions
1)- Is that memory increase typical? All I want to...
|
by: Devesh |
last post by:
Hi, I want to display some parameters & their value in Same data grid as
shown
Parameter | Value | Parameter | Value |Parameter |
Value
So please suggest me the way to Split grid which will have first row as above
& Rest row will contain Param Name & Values. These all parameter & values, i
am having in Data set.
Another...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |