Create file in xml format using visual basic 6.0

I want to create a file which would be in xml format using file I/O which will loop into the database and display in xml format.As I am not aware of how to create xml file in visual basic.I have created normal text files in VB,Is that the same way for creating xml files.....
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yeah it is the same as making a text file, just as long as your using the correct method
Like below
Open App.Path & "\Test.xml" For Output As #1
    Print #1, Whole  *** whole being the formated xml
Close #1
chitramahadikAuthor Commented:
Can u give me any example for the same ,so I can understand the same well
yes it's just the same.... just give them an xml extension
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

chitramahadikAuthor Commented:
I am getting the following error
A string literal was expected, but no opening quote character was found. Error processing resource 'file:///C:/invoice.xml'. Line 1, Position 15

<?xml version=3.0?>

For ur reference I am pasting my code down

Private Sub cmdCreateXML_Click()
Dim vStrSql As String
Dim vStrfilename As String
Dim vIntFreeHandle As Integer
Dim vRsInvoice As New ADODB.Recordset
Dim oField As ADODB.Field

On Error GoTo ErrorHandler

CommonDialog1.Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist
CommonDialog1.Filter = "XML Files (*.xml)|*.xml"


vStrfilename = CommonDialog1.filename
Me.MousePointer = vbHourglass
' get a free handle for the file and open it for output
    vIntFreeHandle = FreeFile
    Open vStrfilename For Output As #vIntFreeHandle
    'start New
    Print #vIntFreeHandle, "<?xml version=3.0?>"
    Print #vIntFreeHandle, vbCrLf
    Print #vIntFreeHandle, "<InvoiceFile>"
    Print #vIntFreeHandle, "<fileformat>4.00</fileformat>"
    Print #vIntFreeHandle, "<created>" & Format(Date, "yyyymmdd") & "</created>"
    Print #vIntFreeHandle, vbCrLf
    vStrSql = "SELECT * from Client_Invoices"
    If vRsInvoice.State = adStateOpen Then vRsInvoice.Close
    vRsInvoice.Open vStrSql, conn, adOpenStatic, adLockOptimistic, adCmdText
    If vRsInvoice.State = adStateOpen Then
        If vRsInvoice.RecordCount > 0 Then
            Do While Not vRsInvoice.EOF
                    For Each oField In vRsInvoice.Fields
                        Print #vIntFreeHandle, "<" & oField.Name & ">" & oField.Value & "</" & oField.Name & ">"
                    Print #vIntFreeHandle, vbCrLf
        End If
    End If
    ' close the file
    Print #vIntFreeHandle, "</invoicefile>"
    Close #vIntFreeHandle
Me.MousePointer = vbNormal
Exit Sub
MsgBox Err.Description
End Sub
Hi chitramahadik,
In VB, go to Project -> References and add a reference to Microsoft XML

Use the XML object to do all of the writing for you!

this line

Print #vIntFreeHandle, "<?xml version=3.0?>"

should be..

Print #vIntFreeHandle, "<?xml version=""3.0""?>"

all values of the attributes should be enclosed in "quotes"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi chit, cant you use the Microsoft XML library?

Its extrememly simple to use and the documentation is here

Let me know if you need any help using these interfaces.
Suggest points to monvelasquez.
Not worth it to split 35 points

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.