UBound - DataSet Less - DataGrid

  • Thread starter Thread starter rawCoder
  • Start date Start date
R

rawCoder

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
 
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)
 
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
 
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
 
Back
Top