|
From: WD on 31 Jan 2008 19:50 Hi, What do I use to display text in a tabular format where i can iterate through columns and rows. I have tried to use the datagrid previously but it needs a datasource. There is also no clear cut solution to add in records to the datagrid. Any source would be appreciated Thanks, -- WD
From: Christopher Fairbairn on 31 Jan 2008 21:16 Hi, "WD" <WD(a)discussions.microsoft.com> wrote in message news:BFD221DD-EC23-40F7-9F25-C45F5606FFA0(a)microsoft.com... > What do I use to display text in a tabular format where i can iterate > through columns and rows. > > I have tried to use the datagrid previously but it needs a datasource. > There > is also no clear cut solution to add in records to the datagrid. You could parse your csv file into a DataTable, and then use this as the datasource. For example: // Create a DataTable containing our data DataTable dt = new DataTable("People"); dt.Columns.Add("Name", typeof(String)); dt.Columns.Add("Age", typeof(int)); dt.Rows.Add("Christopher", 25); dt.Rows.Add("Bob", 31); dt.Rows.Add("Jane", 30); // Use it as the datasource for our data grid dataGrid1.DataSource = dt; To add new/edit data you can just alter the DataTable and the datagrid will update automatically. Hope this helps, Christopher Fairbairn
From: " ctacke/>" on 31 Jan 2008 22:52 Another possible solution is to use the TextDataAdapter from the Smart Device Framework. It provides a direct DataAdapter to a CSV file, making it directly bindable. http://opennetcf.com/library/sdf/html/9ad043db-5fff-ce9f-cf21-4d1d5634f638.htm -- Chris Tacke, eMVP Join the Embedded Developer Community http://community.opennetcf.com "WD" <WD(a)discussions.microsoft.com> wrote in message news:BFD221DD-EC23-40F7-9F25-C45F5606FFA0(a)microsoft.com... > Hi, > > What do I use to display text in a tabular format where i can iterate > through columns and rows. > > I have tried to use the datagrid previously but it needs a datasource. > There > is also no clear cut solution to add in records to the datagrid. > > Any source would be appreciated > > Thanks, > > -- > WD
From: WD on 31 Jan 2008 23:00 Thanks! That worked perfectly. How would I implement a search in this... i tried dt.Rows.Find(<key>); but it didn't work b/c I have no primary key. Is there a way to search the whole contents of the data on the datagrid(or even just by rows), and then extract a whole row out and split into variables? Thanks -- WD "Christopher Fairbairn" wrote: > Hi, > > "WD" <WD(a)discussions.microsoft.com> wrote in message > news:BFD221DD-EC23-40F7-9F25-C45F5606FFA0(a)microsoft.com... > > What do I use to display text in a tabular format where i can iterate > > through columns and rows. > > > > I have tried to use the datagrid previously but it needs a datasource. > > There > > is also no clear cut solution to add in records to the datagrid. > > You could parse your csv file into a DataTable, and then use this as the > datasource. For example: > > // Create a DataTable containing our data > DataTable dt = new DataTable("People"); > dt.Columns.Add("Name", typeof(String)); > dt.Columns.Add("Age", typeof(int)); > > dt.Rows.Add("Christopher", 25); > dt.Rows.Add("Bob", 31); > dt.Rows.Add("Jane", 30); > > // Use it as the datasource for our data grid > dataGrid1.DataSource = dt; > > To add new/edit data you can just alter the DataTable and the datagrid will > update automatically. > > Hope this helps, > Christopher Fairbairn >
|
Pages: 1 Prev: SQL Compact Development Next: Creating dll using VS 2005 |