473,320 Members | 1,977 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,320 software developers and data experts.

DataGrid Issues

I am having two issues with my datagrid. First, my column headers are not displaying.

Second, the grid runs and displays correctly (except the headers) the first time. When the grid runs for the second time I get an error

An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dl

Additional information: Cannot create a child list for field Additional

The code is below. Does anyone see the error

Thanks in Advance
Elen

strsql = "Select add_desc, add_cost from Additional where expense_id = " & TextBox3.Text & " order by add_id desc
Debug.Write(strsql

' Create data adapter objec
Dim daGrid As OleDbDataAdapter = New OleDbDataAdapter(strsql, Expenses.conn

' Create a dataset object and fill with data using data adapter's Fill metho
Dim dsGrid As DataSet = New DataSe
daGrid.Fill(dsGrid, "Additional"
Dim dvGrid As DataView = dsGrid.Tables("Additional").DefaultVie
DataGrid1.DataMember = "Additional
DataGrid1.DataSource = dvGri

Dim dgts As DataGridTableStyle = New DataGridTableStyl
dgts.MappingName = "Additional

dgts.GridColumnStyles.Add(New DataGridTextBoxColumn
dgts.GridColumnStyles.Item(0).MappingName = "add_desc
dgts.GridColumnStyles.Item(0).HeaderText = "Description
dgts.GridColumnStyles.Item(0).Width = 30
dgts.GridColumnStyles.Add(New DataGridTextBoxColumn
dgts.GridColumnStyles.Item(1).MappingName = "add_cost
dgts.GridColumnStyles.Item(1).HeaderText = "Cost
dgts.GridColumnStyles.Item(1).Width = 200
Nov 20 '05 #1
4 1396
Hi,

I dont see where you add the datagrid table style to the datagrid.

Ken
---------------------------
"ElenaR" <an*******@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com...
I am having two issues with my datagrid. First, my column headers are not
displaying.

Second, the grid runs and displays correctly (except the headers) the
first time. When the grid runs for the second time I get an error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll

Additional information: Cannot create a child list for field Additional.
The code is below. Does anyone see the error?

Thanks in Advance,
Elena

strsql = "Select add_desc, add_cost from Additional where expense_id = " &
TextBox3.Text & " order by add_id desc"
Debug.Write(strsql)

' Create data adapter object
Dim daGrid As OleDbDataAdapter = New OleDbDataAdapter(strsql,
Expenses.conn)

' Create a dataset object and fill with data using data adapter's
Fill method
Dim dsGrid As DataSet = New DataSet
daGrid.Fill(dsGrid, "Additional")
Dim dvGrid As DataView = dsGrid.Tables("Additional").DefaultView
DataGrid1.DataMember = "Additional"
DataGrid1.DataSource = dvGrid

Dim dgts As DataGridTableStyle = New DataGridTableStyle
dgts.MappingName = "Additional"

dgts.GridColumnStyles.Add(New DataGridTextBoxColumn)
dgts.GridColumnStyles.Item(0).MappingName = "add_desc"
dgts.GridColumnStyles.Item(0).HeaderText = "Description"
dgts.GridColumnStyles.Item(0).Width = 300
dgts.GridColumnStyles.Add(New DataGridTextBoxColumn)
dgts.GridColumnStyles.Item(1).MappingName = "add_cost"
dgts.GridColumnStyles.Item(1).HeaderText = "Cost"
dgts.GridColumnStyles.Item(1).Width = 200

Nov 20 '05 #2
One problem solved! I can't believe I forgot to add the style.

Anyway, the second error is still coming up.

Any Ideas

Thanks
Elen
----- Ken Tucker [MVP] wrote: ----

Hi

I dont see where you add the datagrid table style to the datagrid

Ke
--------------------------
"ElenaR" <an*******@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com..
I am having two issues with my datagrid. First, my column headers are not
displaying
Second, the grid runs and displays correctly (except the headers) the

first time. When the grid runs for the second time I get an error
An unhandled exception of type 'System.ArgumentException' occurred in

system.windows.forms.dl
Additional information: Cannot create a child list for field Additional
The code is below. Does anyone see the error

Thanks in Advance

Elen
strsql = "Select add_desc, add_cost from Additional where expense_id = " &> TextBox3.Text & " order by add_id desc

Debug.Write(strsql
' Create data adapter objec

Dim daGrid As OleDbDataAdapter = New OleDbDataAdapter(strsql,
Expenses.conn
' Create a dataset object and fill with data using data adapter's

Fill metho
Dim dsGrid As DataSet = New DataSe
daGrid.Fill(dsGrid, "Additional"
Dim dvGrid As DataView = dsGrid.Tables("Additional").DefaultVie
DataGrid1.DataMember = "Additional
DataGrid1.DataSource = dvGri
Dim dgts As DataGridTableStyle = New DataGridTableStyl

dgts.MappingName = "Additional
dgts.GridColumnStyles.Add(New DataGridTextBoxColumn

dgts.GridColumnStyles.Item(0).MappingName = "add_desc
dgts.GridColumnStyles.Item(0).HeaderText = "Description
dgts.GridColumnStyles.Item(0).Width = 30
dgts.GridColumnStyles.Add(New DataGridTextBoxColumn
dgts.GridColumnStyles.Item(1).MappingName = "add_cost
dgts.GridColumnStyles.Item(1).HeaderText = "Cost
dgts.GridColumnStyles.Item(1).Width = 200


Nov 20 '05 #3
Hi,

Try deleting this line. You shouldn't need to set the datamember if
you are binding to a dataview.

DataGrid1.DataMember = "Additional"

Ken
-----------------
"Elena R" <el**********@yahoo.com> wrote in message
news:58**********************************@microsof t.com...
One problem solved! I can't believe I forgot to add the style.

Anyway, the second error is still coming up.

Any Ideas?

Thanks,
Elena
----- Ken Tucker [MVP] wrote: -----

Hi,

I dont see where you add the datagrid table style to the
datagrid.

Ken
---------------------------
"ElenaR" <an*******@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com...
>I am having two issues with my datagrid. First, my column headers

are not
>displaying.
>> Second, the grid runs and displays correctly (except the headers) the
> first time. When the grid runs for the second time I get an error:
>> An unhandled exception of type 'System.ArgumentException' occurred

in
> system.windows.forms.dll
>> Additional information: Cannot create a child list for field

Additional. >>> The code is below. Does anyone see the error?
>> Thanks in Advance,

> Elena
>> strsql = "Select add_desc, add_cost from Additional where

expense_id = " &> TextBox3.Text & " order by add_id desc"
> Debug.Write(strsql)
>> ' Create data adapter object

> Dim daGrid As OleDbDataAdapter = New OleDbDataAdapter(strsql,
> Expenses.conn)
>> ' Create a dataset object and fill with data using data

adapter's
> Fill method
> Dim dsGrid As DataSet = New DataSet
> daGrid.Fill(dsGrid, "Additional")
> Dim dvGrid As DataView =

dsGrid.Tables("Additional").DefaultView
> DataGrid1.DataMember = "Additional"
> DataGrid1.DataSource = dvGrid
>> Dim dgts As DataGridTableStyle = New DataGridTableStyle

> dgts.MappingName = "Additional"
>> dgts.GridColumnStyles.Add(New DataGridTextBoxColumn)

> dgts.GridColumnStyles.Item(0).MappingName = "add_desc"
> dgts.GridColumnStyles.Item(0).HeaderText = "Description"
> dgts.GridColumnStyles.Item(0).Width = 300
> dgts.GridColumnStyles.Add(New DataGridTextBoxColumn)
> dgts.GridColumnStyles.Item(1).MappingName = "add_cost"
> dgts.GridColumnStyles.Item(1).HeaderText = "Cost"
> dgts.GridColumnStyles.Item(1).Width = 200


Nov 20 '05 #4
YAY! Thank you, Thank you, Thank you!!

Finally
Elen
----- Ken Tucker [MVP] wrote: ----

Hi

Try deleting this line. You shouldn't need to set the datamember if
you are binding to a dataview

DataGrid1.DataMember = "Additional

Ke
----------------
"Elena R" <el**********@yahoo.com> wrote in message
news:58**********************************@microsof t.com..
One problem solved! I can't believe I forgot to add the style
Anyway, the second error is still coming up
Any Ideas
Thanks

Elen
----- Ken Tucker [MVP] wrote: ----

Hi
I dont see where you add the datagrid table style to the

datagrid
Ke

--------------------------
"ElenaR" <an*******@discussions.microsoft.com> wrote in messag
news:93**********************************@microsof t.com..
I am having two issues with my datagrid. First, my column headers

are no
displaying
Second, the grid runs and displays correctly (except the headers) th
first time. When the grid runs for the second time I get an error
An unhandled exception of type 'System.ArgumentException' occurred

i
system.windows.forms.dl
Additional information: Cannot create a child list for field

Additional The code is below. Does anyone see the error
Thanks in Advance

Elen
strsql = "Select add_desc, add_cost from Additional where

expense_id = " &> TextBox3.Text & " order by add_id desc
Debug.Write(strsql
' Create data adapter objec

Dim daGrid As OleDbDataAdapter = New OleDbDataAdapter(strsql
Expenses.conn
' Create a dataset object and fill with data using data

adapter'
Fill metho
Dim dsGrid As DataSet = New DataSe
daGrid.Fill(dsGrid, "Additional"
Dim dvGrid As DataView =

dsGrid.Tables("Additional").DefaultVie
DataGrid1.DataMember = "Additional
DataGrid1.DataSource = dvGri
Dim dgts As DataGridTableStyle = New DataGridTableStyl

dgts.MappingName = "Additional
dgts.GridColumnStyles.Add(New DataGridTextBoxColumn

dgts.GridColumnStyles.Item(0).MappingName = "add_desc
dgts.GridColumnStyles.Item(0).HeaderText = "Description
dgts.GridColumnStyles.Item(0).Width = 30
dgts.GridColumnStyles.Add(New DataGridTextBoxColumn
dgts.GridColumnStyles.Item(1).MappingName = "add_cost
dgts.GridColumnStyles.Item(1).HeaderText = "Cost
dgts.GridColumnStyles.Item(1).Width = 20

Nov 20 '05 #5

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

Similar topics

5
by: ManuNeko | last post by:
Can anyone tell me how to work with a datagrid or where I can find a tutorial or an example? I have a datagrid on my form and now if a user adds a row I want to insert that row into the...
20
by: Peter | last post by:
I have the following Class, but I would like to make one of the columns in my DataGrid editable, how would I do that? When I use this class none of the columns are editable even when I set the...
2
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3...
7
by: GaryDean | last post by:
(one of our developers posted this and it got no answer so I'm giving it another try) I'm converting a DataGrid utility component that previously used the columns array to function as it has in...
2
by: cj | last post by:
I was looking over some of my 2003 code today (see below) that loads a foxpro table via oledb connection. I used a sub "autosizecolumns" I found on the web but I never quite understood why they...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.