DataGrid

M

Michael

Hi to all,
I have a general question:

I use .Net 2003 enterprose edition and C# to implement an
aplication for a pocket PC

is it possible, that I can't use DataGrid and the method
SetDataBinding for an application running on a pocket pc?

I used the same code (comming from MSDN help-file) in an
application for pocket pc and in a windows application!

On windows forms it works fine and in the pocket pc
application, I get some errors, that the method can't be
found.

thanks for help
 
M

Maarten Struys, eMVP

The method SetDataBinding is not supported in the .NET Compact Framework.
The .NET Compact Framework is a subset of the .NET Framework that has to fit
in devices with smaller memory footprint, so not all methods are available.
 
C

Cindy Cruciger

I did battle with this one as well

I eventually did this:

This loads one XML file containing five linked tables
string sXMLFilePath = "\\program files\\eHomeDelivery";

string sXMLFileName = "DatFile.XML";

string xmlfilename = sXMLFilePath + "\\" + sXMLFileName;

FileStream FsXML = new FileStream(xmlfilename, FileMode.Open);

DataSet SEGAddrDS = new DataSet();

XmlTextReader xtrXML = new XmlTextReader(FsXML);

foreach (DataTable t in SEGAddrDS.Tables)

t.BeginLoadData();

SEGAddrDS.ReadXml(xtrXML);

foreach (DataTable t in SEGAddrDS.Tables)

t.EndLoadData();

xtrXML.Close();

FsXML.Close();

// (At first I was reading the XSD but my data file changes every day and it

//couldn't find the xsd. I discovered through trial and error that it will
infer

//an XSD from the XML)

// (Put it all in the respective tables where SEGAddrDS is the name

//I gave my DataSet and ["Segment"] is the top node name of the table in the
file.

dtSegment = SEGAddrDS.Tables["Segment"];

dtAddr = SEGAddrDS.Tables["Address"];

dtDraw = SEGAddrDS.Tables["Publication"];

dtSubscription = SEGAddrDS.Tables["Subscription"];

dtRoute = SEGAddrDS.Tables["Route"];

dataGrid1.DataSource = SEGAddrDS;

dataGrid1.DataBindings.Add("Text",SEGAddrDS.Tables["Route"],"RouteCode");

// "RouteCode" is a key field in the "Route" table.

// Now when you run the app you can see your grid populated with all of the
data. In the end for my app I ended up loading the tables into arrays and
displaying the data with labels. Grids just have no nice way to format the
output in colors and varied column widths independent of rows.



Hope this helps,



Cindy Cruciger

(e-mail address removed)
 

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.

Ask a Question

Top