Re: Zooming Out: The Larger Issue






Well i personally would have chosen a different aproach

I would have set up a dataset with the desired interface with the dataset
designer , and then bind my controls to this dataset

Then you can add colors with the bound controls and save the dataset to a
XML file or a binary file ( smaller and faster to serialize deserialize ,
however you can`t add items then with notepad )

On startup of your app you could just check if the xml / binary file exists
and if so desiaralize it to a dataset object and rebind it to your controls

The above requires verry few coding ( it is 80% draging and dropping )

you may also choose to do it all from code
to get you started with this
http://www.startvbdotnet.com/ado/datatable.aspx


dataset = the container of one or more datatables

datatable = the container of one or more datarows

datarow = the container of one or more datacolumns wich in there turn hold
the values ( it ends there :-)

so in simplified XML it looks like this

1 dataset with 1 datable 1 datarow and 1 datacolumn

<dataset>
<datatable>
<datarow>
<datacolumn>
this is the value of colun 1
</datacolumn>
</datarow>
</datatable>
</dataset>


So if you refer in code to datatable(0) you get all items that are nested in
the first datatable object even so with the rows and columns

This represents a pseudo dataset with 1 datatable , 2 datarows and 3 data
columns

<dataset>
<datatable>
<datarow>
<datacolumn>
1
</datacolumn>
<datacolumn>
2
</datacolumn>
<datacolumn>
3
</datacolumn>
</datarow>
<datarow>
<datacolumn>
4
</datacolumn>
<datacolumn>
5
</datacolumn>
<datacolumn>
6
</datacolumn>
</datarow>
</datatable>
</dataset>

If you want a good reference about datasets i would recomend you one of the
ADO.Net books of MS press (i own the advanced topics book wich is verry
good )

regards

Michel Posseth [MCP]






"Peter" <starrim@xxxxxxxxxxx> schreef in bericht
news:c1GPh.18506$tD2.11214@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The more questions I ask, the more likely I'll ask the right one and
someone will answer it, right?

Here's the big picture on my project: I'm writing a program that will keep
track of, among other things, paper inventory. I want there to be a master
list of available paper colors on a form that users can choose from, each
one having a name and a color box. The colors would be grouped into
categories; i.e. brands etc. I also want there to be a way for users to
add and delete colors and groups from the master list. I therefore
envisioned having a simple XML file with the paper colors stored in it
that the program referenced each time it wanted to build this control. The
XML file would have the general structure:

<AllPaperColors>
<PaperColorSet name="Pastels">
<PaperColor color="ff928a" name="Cherry"></PaperColor>
<PaperColor color="ad4325" name="Azure"></PaperColor>
<PaperColor color="423441" name="Orchid"></PaperColor>
<PaperColor color="000997" name="Peach"></PaperColor>
</PaperColorSet>
<PaperColorSet name="Astrobrights">
<PaperColor color="aaeeff" name="Ice"></PaperColor>
<PaperColor color="ff0099" name="Magenta"></PaperColor>
<PaperColor color="ff5600" name="Chartreuse"></PaperColor>
<PaperColor color="0099ff" name="Aqua"></PaperColor>
</PaperColorSet>
</AllPaperColors>

This XML file seemed like the most elegant and supremely simple of all
possible solutions... quite aside from the fact that I don't know what SQL
Server is, and it sounds like it costs money, extra hardware, and months
to learn, none of which I am willing to invest at this point.

Not knowing at all how to approach reading a file structured like this, I
decided to use a DataSet object... it allows both reading and writing in
non-sequential order. I wrote an XML schema to match the above file and
applied it to the DataSet, even though it seemed to work ok without doing
so. I still don't know what the benefit of that was, other than that now I
can click "Validate XML" and no errors come up.

Now I'm having problems accessing nested elements in the bizarre structure
of the DataSet object. I don't know what properties and methods to use to
get it to do what I want. Several of them have similar descriptions that I
can't tell apart. For example, I notice that there is a Tables collection,
but there is also a PaperColorSet property. What the heck is that? Which
one contains the data? And the Rows collection... what's the difference
between Rows(0) and Rows.Item(0)? Why does neither one have a ToString
property? I have a lot of questions like that. Add that to the nested
tables confusion I already mentioned in a previous post.

So my question to you genius VB developers out there is this: have I taken
a bizarre or non-standard approach to a really simple problem? Is there
any step in the process I described above (including the structure of the
XML file, or the choice to use XML at all) that is unquestionably
inferior? I'm groping in the dark, and every tiny step is a bloody battle.

If I have done ok so far, are there any resources I could read now to
learn what tables really are? And how XML elements containing attributes,
content, and other elements are translated into tables, rows, and columns?
It's an odd way for me to conceptualize representing such simple data, and
the graphical XML designer is only adding to my confusion at this point.
Not too much longer, and I may go off the deep end and try to write an XML
parser from the ground up -- one I can understand!

Any thoughtful help is much appreciated.


.



Relevant Pages

  • Re: xml in plain text file on heavy load.
    ... even if the XML file is magically and perfectly ... I want to emphasize that IIS would never be caching that XML file on its own ... Application is NOT synchronizing access to your ASP pages. ...
    (microsoft.public.inetserver.iis)
  • Re: TAPI 3.0 call attached data
    ... The format of the Call Attached Data is XML. ... XML file with CallAttchedData represents one or multiple data lists ... Root element is CallAttachedData. ... version CDATA #FIXED "1.0" ...
    (microsoft.public.win32.programmer.tapi)
  • Re: XML parser and writer
    ... them on a calendar. ... Therefore I will need to both easily parse and write new XML files. ... why not some database technology? ... an advanced user can edit the XML file directly at ...
    (comp.lang.java.programmer)
  • Re: XmlTextReader or XmlDocument or SQLCE
    ... I wouldn't really call it "unrealistic expectations", ... I would love to see a 1 second response time ... reading a single node from a 200k XML file on any version of CF running on ... > As to saving XML file after each change, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: DataRelation
    ... Aufbau der XML Datei. ... > DataRow messRow = null; ... DataRow messwRow; ... Next by Date: ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)