By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,685 Members | 1,674 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,685 IT Pros & Developers. It's quick & easy.

DataGrid Issues

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.