Objective
To develop a Windows application to read an xml file; perform insert, search, update, and delete operations, and navigation of records and display respective images.
Design
![Reading and manipulating]()
Design the form as above with 1 DataGridView, 1 PictureBox control, 2 OpenFileDialog controls, 4 Labels, 4 TextBoxes, and 12 Buttons.
PictureBox1 Properties
Code
Note. In this application, we will search a record by taking input from the InputBox. For this, we have to add a reference to Microsoft.VisualBasic.
Adding a reference
- Goto Project Menu->Add Reference -> select 'Microsoft.VisualBasic' from the .NET tab.
- To use this we have to include the namespace: 'using Microsoft.VisualBasic'
- XML files and respective JPEG images should be maintained in the same folder.
Creating an XML file
Example for Creating an XML file
Open Notepad and type the following & save it with the extension '.xml'.
Execution
To execute the application click the loadxml button and select an xml file (a folder 'student data' consisting of the xml file is placed in 'xmlapp.zip' along with source code)
Another way of handling XML file
Performing operations on xml files and saving changes, which includes creating xml elements(tags), assigning values, and appending them to xml root elements.
(for this we have to include namespace 'using System.Xml')
Insert a record
For example to insert a record