Add row to datagrid without underlying table?

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

is it possible to add a row to a Windows datagrid witthout having a
datatable? I need to add a row to the datagrid control.

Thanks.
 
Jim,

I'm not entirely sure I understand your question. A datagrid must have a
data source, but this doesn't have to be a DataTable. In fact, it could be
any component that implements the IList or IListSource interface, so even a
simple ArrayList is valid. The datagrid shows the items in the data source,
so you can add rows by adding items to the underlying data source. By
default, users can also modify or delete existing items (rows) or add new
ones in the UI, and those changes can persist in the data source.

I hope this helps. I might be able to provide more info if you can clarify
just what you're trying to accomplish.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks for the post.
I need to display many rows of data without having to store all the data in
memory. If I load it in a datatable, the datatable will start filling up and
it'll consume most (if not all) of the PC's memory. I only want to display
the data, not store it in memory.

Kai Brinkmann said:
Jim,

I'm not entirely sure I understand your question. A datagrid must have a
data source, but this doesn't have to be a DataTable. In fact, it could be
any component that implements the IList or IListSource interface, so even a
simple ArrayList is valid. The datagrid shows the items in the data source,
so you can add rows by adding items to the underlying data source. By
default, users can also modify or delete existing items (rows) or add new
ones in the UI, and those changes can persist in the data source.

I hope this helps. I might be able to provide more info if you can clarify
just what you're trying to accomplish.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jim" <none> wrote in message news:[email protected]...
is it possible to add a row to a Windows datagrid witthout having a
datatable? I need to add a row to the datagrid control.

Thanks.
 
.... and I want to be able to update the grid continuously swhile it's being
filled up.



Kai Brinkmann said:
Jim,

I'm not entirely sure I understand your question. A datagrid must have a
data source, but this doesn't have to be a DataTable. In fact, it could be
any component that implements the IList or IListSource interface, so even a
simple ArrayList is valid. The datagrid shows the items in the data source,
so you can add rows by adding items to the underlying data source. By
default, users can also modify or delete existing items (rows) or add new
ones in the UI, and those changes can persist in the data source.

I hope this helps. I might be able to provide more info if you can clarify
just what you're trying to accomplish.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jim" <none> wrote in message news:[email protected]...
is it possible to add a row to a Windows datagrid witthout having a
datatable? I need to add a row to the datagrid control.

Thanks.
 
I'm afraid a datagrid may not be the correct choice for you then. Since the
data grid must be bound to a valid data source, it requires an internal
representation of this data in memory. The data grid is specifically
intended to display and modify the underlying data structure, and it cannot
be used independently of its data source. Its primary purpose really is to
display ADO.NET data. You do have direct programmatic access to the grid's
data items via the DataGrid.Items collection. However, this property does
not allow you to add or delete any items.

You might have to use (or create) a different control to display your data
without storing it in memory. Sorry I couldn't help you more.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


Jim said:
Thanks for the post.
I need to display many rows of data without having to store all the data in
memory. If I load it in a datatable, the datatable will start filling up and
it'll consume most (if not all) of the PC's memory. I only want to display
the data, not store it in memory.

Kai Brinkmann said:
Jim,

I'm not entirely sure I understand your question. A datagrid must have a
data source, but this doesn't have to be a DataTable. In fact, it could be
any component that implements the IList or IListSource interface, so
even
a
simple ArrayList is valid. The datagrid shows the items in the data source,
so you can add rows by adding items to the underlying data source. By
default, users can also modify or delete existing items (rows) or add new
ones in the UI, and those changes can persist in the data source.

I hope this helps. I might be able to provide more info if you can clarify
just what you're trying to accomplish.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jim" <none> wrote in message news:[email protected]...
is it possible to add a row to a Windows datagrid witthout having a
datatable? I need to add a row to the datagrid control.

Thanks.
 
Which control would you suggest?


Kai Brinkmann said:
I'm afraid a datagrid may not be the correct choice for you then. Since the
data grid must be bound to a valid data source, it requires an internal
representation of this data in memory. The data grid is specifically
intended to display and modify the underlying data structure, and it cannot
be used independently of its data source. Its primary purpose really is to
display ADO.NET data. You do have direct programmatic access to the grid's
data items via the DataGrid.Items collection. However, this property does
not allow you to add or delete any items.

You might have to use (or create) a different control to display your data
without storing it in memory. Sorry I couldn't help you more.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jim" <none> wrote in message news:[email protected]...
Thanks for the post.
I need to display many rows of data without having to store all the data in
memory. If I load it in a datatable, the datatable will start filling up and
it'll consume most (if not all) of the PC's memory. I only want to display
the data, not store it in memory.
could
be
any component that implements the IList or IListSource interface, so
even
a
simple ArrayList is valid. The datagrid shows the items in the data source,
so you can add rows by adding items to the underlying data source. By
default, users can also modify or delete existing items (rows) or add new
ones in the UI, and those changes can persist in the data source.

I hope this helps. I might be able to provide more info if you can clarify
just what you're trying to accomplish.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jim" <none> wrote in message is it possible to add a row to a Windows datagrid witthout having a
datatable? I need to add a row to the datagrid control.

Thanks.
 
Back
Top