473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Zooming Out: The Larger Issue (A Question for Experts)

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.

Apr 1 '07 #1
4 1077

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" <st*****@hotmail.comschreef in bericht
news:c1*******************@newsread1.news.pas.eart hlink.net...
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.

Apr 1 '07 #2


http://sholliday.spaces.live.com/blog/
If you're starting from scratch, then I'd create a strongly typed dataset
first.
This will make life easier on you.
Your xml below isn't bad, but its not as "dataset-ish" as it ought to be.

After you create a strong dataset, you can manually add rows to you.

Then you can do a myDS.Write( @"C:\myfile.xml") and see the output.

This is a better direction of approach then the other way.
5/24/2006
Custom Objects/Collections and Tiered Development
If you download my example, you can do something like this:
CustomerOrderInfoDSNoConstraintsDS myds = new
CustomerOrderInfoDSNoConstraintsDS();

myds.Customer.AddNewCustomerRow ( "111" , "John" , "Boise" ) ;
myds.Customer.AddNewCustomerRow ( "222" , "Mary" , "Winchester");

myds.Order.AddNewOrderRow( 1001 , "111" , DateTime.Now , DateTime.Now ,
1.00 ) ; //you may have to adjust a little
myds.Order.AddNewOrderRow( 2002 , "222" , DateTime.Now , DateTime.Now ,
2.00 ) ;//you may have to adjust a little

myds.Write ( @"C:\myfirststrongdsfile.xml" ) ;
That should get you going.

DataSet xml is largely ~element based. Your xml above is largely ~attribute
based.

Doing the above example will show you the difference.



"Peter" <st*****@hotmail.comwrote in message
news:c1*******************@newsread1.news.pas.eart hlink.net...
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.

Apr 2 '07 #3
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
Thank you for the idea. I think I am going to try to pursue a course of
action similar to this.

Apr 3 '07 #4
If you're starting from scratch, then I'd create a strongly typed dataset
first.
This will make life easier on you.
Your xml below isn't bad, but its not as "dataset-ish" as it ought to be.
....
DataSet xml is largely ~element based. Your xml above is largely
~attribute
based.
Thank you for the distinction. I designed the XML structure by hand before
going into VB, doing what seemed to make the most sense semantically... i.e.
the Name of a PaperColor element seemed more like an attribute than a child
element... but you're right; it makes the dataset a lot more cryptic to work
with. Thanks for the help.

Apr 3 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with...
0
by: Gopi | last post by:
Hi All I have set a BackgroundImage for windows forms and i need to implement the image zooming feature for the form ie when ever i m zooming in or zooming out the form the corrosponding...
4
by: Andy | last post by:
I created a Windows application that is having an odd issue. The application starts for a split second, but then closes. I cannot get any error messages to display as to what causes the program...
0
by: pavanjosh | last post by:
Hello Frineds, Can anyone please help me in getting the code or library for written in C# for zooming in and zooming out the images in the picture box? Or is there any other way from which i can...
4
by: tkirankumar | last post by:
Hi all, This is regarding the issue I am facing while porting the my application from SuSe Linux to Sun Solaris. The Existing system details: Itanium boxes 1mhz 4 processor 8 gb machines with...
1
by: Rathorevivek | last post by:
Hi All, I have been using full text search in my application for search purpose. But on certain words i.e Noise Words such as And,After,About etc. I am receiving the following error: ...
2
by: Steve K. | last post by:
I am in over my head I think, I've got my brain running in circles trying to figure this out. I'm using remoting with a client and a server. I need the server to raise events on the client and...
11
by: blunt | last post by:
trying to write a program to write the configuration files for a load of wireless access points. i've never been a good programmer and haven't done any for nearly a decade so have obviously made some...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.