// create a DataTable
DataTable aTbl = new DataTable("Test") ;
DataColumn aClmn ;
aClmn = new DataColumn("aaa") ;
aClmn.DataType= System.Type.GetType("System.Char");
aTbl.Columns.Add(aClmn) ;
aClmn = new DataColumn("Count") ;
aClmn.DataType= System.Type.GetType("System.Int16");
aTbl.Columns.Add(aClmn) ;
aClmn = new DataColumn("Frequency") ;
aClmn.DataType= System.Type.GetType("System.Double");
aTbl.Columns.Add(aClmn) ;
aClmn = new DataColumn("RealChar") ;
aClmn.DataType= System.Type.GetType("System.Char");
aTbl.Columns.Add(aClmn) ;
// fill in the relevant data
for (char ch = 'A' ; ch <= 'Z' ; ch++)
{
int Row = ch - 'A' ;
DataRow aRow;
aRow = aTbl.NewRow() ;
aRow["aaa"] = ch ;
aRow["Count"] = _Table[ch] ;
double aFreq = (100.0 * _Table[ch]) / _Table.TotalCount ;
aRow["Frequency"] = aFreq ;
aTbl.Rows.Add(aRow) ;
}
dataGrid2.DataSource = aTbl ;
thanks
Yoramo
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.