Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
End Users
Pocket PCActiveSyncMultimediaEBooksWirelessSmartPhones
Developers
Windows MobileSmartPhonesWinCE ProgrammingVB for WinCEVC++ for WinCEPlatform BuilderTest Tools
PocketPC DirectoryFree SoftwareWeb Resources
Related Topics
PalmMobile PhonesMore Topics ...

Pocket PC Forum / Developers / Windows Mobile / January 2008

Tip: Looking for answers? Try searching our database.

reading a text/csv and displaying in table format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WD - 31 Jan 2008 00:50 GMT
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,

Signature

WD

Christopher Fairbairn - 31 Jan 2008 02:16 GMT
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.

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
WD - 31 Jan 2008 04:00 GMT
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
Signature

WD

> Hi,
>
[quoted text clipped - 25 lines]
> Hope this helps,
> Christopher Fairbairn
<ctacke/> - 31 Jan 2008 03:52 GMT
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

Signature

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com

> Hi,
>
[quoted text clipped - 8 lines]
>
> Thanks,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.