VB.net Discussion

I need help with XML serialization. I have read my book and a few other tutorials but(call me lazy) i cant seem to grasp the concept. I am wanting to use VB.net and the XMLSerialization class to store a small amount of data. I want to have that data categorized by "Time Zones" and under each time zone i want to be able to add multiple "urls" for example

<Servers>
<Eastern Zone>
<URL="www.url1.com">
<URL="www.url2.com"
</Eastern Zone>
<Central Zone>
<URL="www.url1.com">
<URL="www.url2.com"
</Central Zone>
</Servers>


You get the point i think.... In my application i want to be able to add "Time Zones" and add URLS to those time zones. I also want to be able to delete a specific URL from the zone and be able to edit the URLS and Edit the Zone names.

I would like the Zones to be read into a combo box and i would like the URLS to be listed in a list box. I only want the urls of the currently zone to be available in the list box.

Im not asking anyone to do this for me. I simply need some guidence and help understanding how XML serialization works. I need to know how i need to go about solving my problem.
 
The easiest way to do it is to serialize it into a DataSet. The DataSet will give you a relation DB view of your data. You could then use the DataSet to build yourself a DataGrid including a drop down for your URL's.

However your XML schema will not quite work for this. Lets see...it would need to be more like this:

<Servers>
<zone name="eastern">
<urls>
<url>www.url1.com</url>
<url>www.url2.com</url>
</urls>
</zone>
<zone name="central">
<urls>
<url>www.url1.com</url>
<url>www.url2.com</url>
</urls>
</zone>
</Servers>

I think this would read into a DataSet as 4 records:
ZONE URL
eastern www.url1.com
eastern www.url2.com
central www.url1.com
central www.url2.com

Not sure if this helps or not...I am just thinking out loud.
 
Thanks Pat... That does help a little. I think i was heading down the wrong path and thats why i couldnt figure out how to do it. I will look into datasets. I think its time for me to get a new book. My last book is a little outdated and providing old information.

If you find the time out of your busy day could you please explain what a dataset is and how they work. Im gonna try and do some research myself today as well.

Thanks again!
 
Rupp that is a good place to start.

Here is my take on DataSets:

Basically, it is a database in memory. A data set can contain one or more DataTable objects. Each DataTable object is made up of DataRow and DataColumn objects. If you have a DataSet with multiple DataTable objects, then those DataTables can have relationships between them just like in SQL Server, Access, or another other DB system.

The DataSet also has methods to read and write data. You can read and write to many different data sources including SQL server (via the SQLClient), Access & mySQL (via the OLEClient) or XML (via XMLStreams).

This allows you to say read a SQLServer and then save it out to XML, or the other way around.

The DataSet also has methods such as the Update method that allow you to read a data from a source, make changes to the DataSet (all in memory so very fast) then finally write the changes back to the data source.

You can also use DataSets to bind to other controls within .NET. For example, instead of creating a table in a loop to display a data table, you can just bind a DataSet (or more susincly a DataView) to a DataGrid control. Or you can bind to DropDownLists, RadioLists, ect.


On the learning and getting books thing. Do some research and see if you can find a local .NET users group. We have one here in Fort Collins (http://www.northerncolorado.net) that has a lot of people always ready to help. Plus, most user groups have links in to INETA that feed them a lot of free books and software to give away at their meetings. I have gone to our users group meeting for about 5 months now and have won a price (always books) 4 out of 5 times....keeps you busy with reading.

Hope this helps.
Patrick
 
Thanks once again pat... From the little bit of time that i have had to research DataSets i was able to discover the dataset tool in the visual studio toolbar under tools. www.dummies.com was able to demonstrate to me how to setup that control. Now i need example of how to actually use it.

Right now i have a dataset control setup under the name dsServers and it has one table tblServers. It also has 3 cols. Region, ServerURL's, and Key(unique)
Code:
++++++++++++++++++++++++++++++++++++++
+          tblServers                +
++++++++++++++++++++++++++++++++++++++
+   Key   +   Region   +  ServerURL  +
++++++++++++++++++++++++++++++++++++++
+    0    +            +             +
++++++++++++++++++++++++++++++++++++++
+    1    +            +             +
++++++++++++++++++++++++++++++++++++++


Now i need to find an example that shows me how to add delete edit update and sort display information stored in that table. At this point in time i have no clue how to use this control.

If anyone has a good tutorial i can read with a simple example of how to use this control please post it.
 
This stuff is going right over my head. I am totally confused about datasets. From what i gather is that dataset work with databases and you can output the information from a database into xml for and vice versa.

Im starting to wonder if it would be easier to simply create a database and connect to it when my application is started. I wouldnt need to stay connected to it since i would only want to populate my application from the database. I would have to reconect when i wanted to makes changes. But with such a small amount of data a database seems to be overkill.

What i am trying to do i give users the option of choosing what server they want to connect to in order to sync their local system time. Since these servers can change their URLS i want to provide a way for the user to be able to add and remove urls from a list. When the list is loaded i was going to have my application attempt to connect to each server and check the validity of the data being set. This would ensure that the server url listed is actually a good server. If the server url was broke i would simply not list that server and then the user wouldnt be able to use that server.

Sounds like such a simple task to me but i am getting frustrated. I could easily hardcode the list of urls and regions and then do the check but that wouldnt give the user the oportunity add and remove servers as they wanted.

If anyone here want to help me with connecting to a database please contact me. As for now i have spent to much time on this one feature and need to move on. For now i will just provide a limited list of servers and will hardcode them.

Thanks for any help.
 
The only language I know is English ( and not very well at that!). Always wanted to learn a programming language. What exactly is .net?
 
Ok.... here i go again. I have read a few tutorials and created a few example database applications that tech me how to display and manipulate my information in a datagrid using data adapters and data sets.

I understand how to bind data to the data grid but i cant figure out how to bind data to a combo box from my table TimeZones and have the serverURL data binded to the check list box.

What i want is to have only the URLS for a certain time zone displayed in the checked list box when that time zone is selected from the combo box.

Im not sure if i have my database set up right. Right now i have it in two tables

tblTimeZone
- Key
- TimeZone

tblServerURLS
-Key
-ServerURLS
-ZoneKey

I use zonekey to identify which time zone the URL is assigned to. So if i run a query and join the tables at tblTimeZone.key and tblServerURLS.ZoneKey and return all ServerURLS and TimeZones ordered by tblTimeZone.TimeZone i can get a list of all the time zones and Server URLS in a data grid.

Now i need to know how to get those same results in a combo box and a Checked list box.

Help Please! If you know how to do this please go into detail or maybe even a step by step how-to if you can. I rather wait for a complete answer than get a short answer that is going to send me on another google search for another 2 weeks.

Thanks
 
hello people, i am new to this forum, i tried searching for what i am going to ask you here but i could not find it..
do you know if there is a plug in or a sample program that i can use vb.net to communicate with the serial port? I dont want complicated stuff, only connection to port # , sending and receiving strings. No error correction or anything complicated!
Any ideas?
Thanks!
 
ok so i am using their class, i am sorry i am not that good with programming languages, i am taking a class in vb.net though and i used to be somewhat good at C++ and pascal some years ago, but i forgot most of it.
So if lets say i want to send a string from example "hello" taken from a textbox1 in vb.net to com port 5 how would i do it? And what if i wanted to get a reply back how would i do that? lets say i wanted to get "hello back"
thanx for any info and your time!
takis
 
Back
Top