P
Peter
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.
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.