473,769 Members | 7,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.net Form to Read and Update XML

I have a form that I'm trying to get to work in VB.net (Standard). I
have a DataGrid and Two Buttons (One for Loading an XML file and
another for Updating the file with the changes I make to the records in
the DataGrid).
(This is a lab I'm working on in a training book - written by Mr.
Gunderloy for MS Exam 70-310).

I pasted the following code with numerous errors, however, when I was
using a trial VB.net copy I was able to get it to work flawlessly.

I've tried several things:
The training book says (after designing the form) to double-click one
of the buttons to open the form's module, then add the following code
at the top (do they really mean the TOP of the module? above the VB
generated code?):

Imports System.Data
Imports System.Xml
_______________ _______________ _________

then the instructions call for placing the below code to handle the
events:

Public Class StepByStep2_4
Dim xdd As XmlDataDocument
Dim ds As DataSet

Private Sub btnLoadXml_Clic k(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnLoadXml.Clic k
Dim xtr As XmlTextReader = _
New XmlTextReader(" C:\Documents and Settings\dcampb e\My
Documents\Visua l Studio 2005\Projects\3 10C02\310C02\Bo oks.xml")

xdd = New XmlDataDocument ()
ds = xdd.DataSet()
ds.ReadXmlSchem a(xtr)
xtr.Close()
xtr = New XmlTextReader(" C:\Documents and Settings\dcampb e\My
Documents\Visua l Studio 2005\Projects\3 10C02\310C02\Bo oks.xml")

xtr.WhitespaceH andling = WhitespaceHandl ing.None
xdd.Load(xtr)
dgXML.DataSourc e = ds
dgXML.DataMembe r = "Book"
xtr.Close()
End Sub
Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSave.Click
Dim xtw As XmlTextWriter = New XmlTextWriter(" C:\Documents and
Settings\dcampb e\My Documents\Visua l Studio
2005\Projects\3 10C02\310C02\Bo oks.xml", System.Text.Enc oding.UTF8)

xtw.Formatting = Formatting.Inde nted
xdd.WriteTo(xtw )
'Clean up
xtw.Close()
MessageBox.Show ("The XML file has been successfully updated !")

End Sub

End Class
_______________ _______________ _______________ ______

Any advice on how to get this to work again, or a better way??
THANKS ALL!

Dav

Sep 13 '06 #1
0 4287

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

Similar topics

8
5521
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table records are manipulated to control the permissions. Example: The Press Release section record would look like this: Username: John Doe Function Name: Press Release
3
7406
by: Brian Keating EI9FXB | last post by:
Hello again, I've already placed a few posts on this topic. This time i've a simple application that exhibits my problem, I've placed sample solution 8k on my website should anyone be interested in having a look. http://briankeating.net/transfer/test.zip To recap the problem I expected (and found). I've a main GUI thead (main form), this GUI thread has an UpdateTextBox function that appends a string in a textbox and It also has a button...
13
2469
by: Ioannis Vranos | last post by:
Why in this code the form *does not refresh* when it gets the focus/after some time? #using <mscorlib.dll> #using <system.windows.forms.dll> #using <system.dll> #using <system.drawing.dll>
25
4073
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
16
453
by: Adda | last post by:
If I cycle through the MdiChildActivate event of the parent form I can read text in a textbox on the child mdiform -- console.writeline(Me.ActiveMdiChild.Controls(1).Text) But if I have a sub in the Parent form and reference a child mdi form like this: Sub ReadText()
4
4013
by: MicroMoth | last post by:
Hi, I'm trying to write a update method, in which when the user clicks the update button the update method is passed 10 form fields. Then a update SQL is run to update the database. My question is whats the best way to pass large numbers of parameters into a method. Ten seems a large number to be passing into and out of a method. Stephen
4
6374
by: Rich_C | last post by:
I'm sure this is very simple, but I have very little experience with javascript -- and what I do know isn't helping me here. I have a simple form where users can enter a quantity (qty) and cost (cost). Users can dynamically add rows to the table so I don't know how many rows might need to be calculated. I need to calculate the total (qty * cost) and put that number in a table cell (or read only input box). I also need to sum the...
8
5281
by: chromis | last post by:
Hi, I'm writing a contacts section for a cms on a website, I've decided to write the section in OO code. So far I have my Contacts object and a page structure I would use for a procedural site. /com/Contacts.cfc <cfcomponent displayname="Contact" output="false" hint="Contact component"> <!--- properties: used for self-documentation ---> <cfproperty name="dsn" displayname="dsn" hint="Contact id (UUID)" type="string" required="false"...
1
3330
by: chromis | last post by:
Hi, I'm having trouble fully implementing the edit section of a contact admin system, so far I have written the following: - Bean (Contact.cfc) - Data Access object (ContactDAO.cfc) - Gateway (ContactGateway.cfc) - index.cfm - Deals with the business logic - display/form.cfm - Produces the form for both add and edit behaviour
3
2212
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus that are SELECT elements (javascript-- one named arrivalcity and one named returncity). Basically they ask for a departure and return city and another menu appears with options based on that city. I can't seem to get the input from these fields in the...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10048
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.