XML is a markup language used for structuring and displaying data in a readable format. The language makes use of tags similar to HTML, but unlike HTML it offers more flexibility to define your own custom tags. VB6 is a programming language by Microsoft. VB6 makes use of objects called ActiveX controls. They provide VB6 programs with a number of capabilities, including writing XML documents within your program. To create and use XML documents in your VB6 program, you have to create a reference to its ActiveX control. Doing this is simple and takes just a few steps.
- Skill level:
Other People Are Reading
Open Visual Basic 6.
Click "Standard EXE" from the new project list. You are now in the Visual Basic 6 programming environment. You should have a default main form on your screen to start adding your controls.
Click "Project," "Add Module." This opens up a code module to start writing your Visual Basic programming code.
Add a reference to the XML Object to your VB6 environment. Click "Project," and then click "References." This opens the References window. Scroll down and select "Microsoft XML, v2.6."
Type the following code:
Dim objXML As MSXML2.DOMDocument
Dim strXML As String Set objXML = New MSXML2.DOMDocument ' put some XML in a variable --- the double quotes are ' VB6's string constant encoding of quotes
strXML = "<example>
<node name=""John Doe""/>
<another value=""Jane Doe""/>
If Not objXML.loadXML(strXML) Then Err.Raise objXML.parseError.errorCode, , objXML.parseError.reason End If
Click "File" and "Save As" to save your Visual Basic project.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for