I must be the only one around that wants to make a Windows program just for the desktop using VB .NET and XML. And do not want to use SQL, OLEDB, ODBC, Access. I just want to use XML to store the Data, read the Data into a DataGrid, add or delete rows, and edit the rows then write the changed Data back to the file. So far I have an XML file, an XSD file, a form with a DataGrid, I have made a DataSet with the following line of code
Dim dsContacts As New DataSet("contacts")
I placed a mainmenu control on the form and use menuitem3 as below. Which populates the DataGrid. Now I understand I have to have a DataTable to be able to do anything with the data. I have read the help files in VB .NET but the more I read them the more confused I get. Can someone please tell me how to make a DataTable using the information below to construct it?
'This code populates the DataGrid
Private Sub MenuItem3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
Me.DataGrid1.Visible = True
'Reads the data from the contacts.xml file
dsContacts.ReadXml(Application.StartupPath & "\contacts.xml")
With DataGrid1
.DataSource = dsContacts
.DataMember = "contacts"
.CaptionText = .DataMember
End With
End Sub
------------------------------------------------------------------------------------------------------------------------
This is the file containing the Data. The name of the file is contacts.xml.
White
Johnson
10932 Bigge Rd.
Menlo Park
CA
94025
408 496-7223
Green
Margie
309 63rd St. #411
Oakland
CA
94618
415 986-7020
Carson
Cheryl
589 Darwin Ln.
Berkeley
CA
94705
415 548-7723
Hunter
Anne
22 Cleveland Av. #14
San Jose
CA
95128
408 286-2428
Straight
Dean
5420 College Av.
Oakland
CA
94609
415 834-2919
-----------------------------------------------------------------------------------------------------------------------
This is the Schema file named contacts.xsd.