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

UBound - DataSet Less - DataGrid

P: n/a
Hi There,

I simply want a DataGrid in .NET which acts .. well like the old VB6 grid
.... where you fill and access elements directly ... not being dependant on
some data source or DataSet to be more precise.

IOW need a perfectly UnBound DataGrid elements of which can be
added/accessed/modified using simple .Rows and .Columns

Thank You,
rawCoder
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
If you need a unbound datagrid, you have to use DataTable class.

Example

//create a new data table
DataTable dgTable = new DataTable();

//lets create one column
DataColumn dgCol = new DataColumn();
dgCol.DataType = System.Type.GetType("System.String");
dgCol.Caption = "Names";
dgCol.ColumnName = "ColName";

//add column to data table
dgTable.Columns.Add(dgCol);

//lets create a row
DataRow dgRow = new DataRow();
dgRow["Names"] = "My Name";

//add row to data table
dgTable.Rows.Add(dgRow);

//set data table as datasource in the data grid
dataGrid1.DataSource = dgTable;

Shak
(Houston)
"rawCoder" <ra******@hotmail.com> wrote in message
news:u2**************@TK2MSFTNGP11.phx.gbl...
Hi There,

I simply want a DataGrid in .NET which acts .. well like the old VB6 grid
... where you fill and access elements directly ... not being dependant on
some data source or DataSet to be more precise.

IOW need a perfectly UnBound DataGrid elements of which can be
added/accessed/modified using simple .Rows and .Columns

Thank You,
rawCoder

Nov 16 '05 #2

P: n/a
Hi RawCoder,

Why? You can simple make a datatable which acts perfectly as the datasource
for a datagrid with what you get a perfectly a not databasebound datagrid
(of couse with one table, with more you need a combined datatable so a
dataset, which is to make as well very easy without a database of course).

I think that it would be even possible to make an own userdatagrid with that
however I see no reason for that.

However when you are not looking for that, forgive me for interrupting this.

Cor
Nov 16 '05 #3

P: n/a
Thanx Shakir and Cor

But you see what i meant by UnBound and Dataset Less grid was that i dont
need the inclusion of any DataSet / DataTable / DataColumn / DataRow /
DataView ... nothing .

All i need is simple grid with data accessible Cell By Cell rather than
record based.

Actually i have certain need for which i want this and i am thinking of
writing a wrapper that does so.

Has someone written a wrapper over it.

Thanx anyways
rawCoder
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.