Datagrid question

Results 1 to 2 of 2

Thread: Datagrid question

  1. #1
    Join Date
    Dec 1969

    Default Datagrid question

    Is it possible to define a column in a datagrid to programmatically count the number of bound records it has? To essentially be a record count column?

  2. #2
    Join Date
    Dec 1969

    Default RE: Datagrid question

    Create a DataTable with with an autoincrement column and bind the autoincrement column to the datagrid.<BR><BR>// DataAdapter da, DataSet ds created<BR>// Fill schema<BR>da.FillSchema(ds, SchemaType.Source, "MyTable");<BR>DataTable dt = ds.Tables["MyTable"];<BR>DataColumn dc = dt.Columns.Add("AutoCol", typeof(int));<BR>dc.AutoIncrement = true;<BR>dc.AutoIncrementSeed = 1;<BR>dc.AutoIncrementStep = 1;<BR><BR>// Fill dataset<BR>da.Fill(ds, "MyTable")<BR><BR>Same for VB except<BR>Dim dc as DataColumn = dt.Columns.Add("AutoCol", GetType(Integer));<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts