Hi there to all

I'm trying to make application which should extract certain data from XML files. I'm using form, combobox and button.

If someone could guide me because I'm not so familiar with programming...

here is code example

To populate Combobox1 and it works fine

Private Sub form1_load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim strpath As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\"
        Dim dirinfo As New IO.DirectoryInfo(strpath)
        For Each file As FileInfo In dirinfo.GetFiles("*.XML", SearchOption.TopDirectoryOnly)
            ComboBox1.Items.Add(file.Name)

        Next

This code should choose file from combobox1 and do READ some data from file I have choosen

Private Sub button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim xmldoc As New XmlDataDocument()
        Dim xmlnode As XmlNodeList
        Dim i As Integer
        Dim str As String
        Dim fs As New FileStream("GET_FILE_FROM_COMBOBOX1", FileMode.Open, FileAccess.Read)
        xmldoc.Load(fs)
        xmlnode = xmldoc.GetElementsByTagName("")
        For i = 0 To xmlnode.Count - 1
            xmlnode(i).ChildNodes.Item(0).InnerText.Trim()
            str = xmlnode(i).ChildNodes.Item(0).InnerText.Trim() & " " &
                xmlnode(i).ChildNodes.Item(1).InnerText.Trim() & " " &
                xmlnode(i).ChildNodes.Item(2).InnerText.Trim()
            MsgBox(str)

        Next

_____
And one last thing ... I'm using MS Visual Studio Community 2015, and can't fogure out where is my ".exe" file, or it is not generated couse errors I'm getting?

Edited 9 Months Ago by SoftBa

Yes, you are right, I need more than just one thing :)

for example, can you make this app read some data from file attached, and show data on msgbox or even better on wordpad document (using wordpad because I don't have MS Office licence on every computer I'm using).

here is sample, and it should be in root directory, and I should select it by navigating combobox ...

Thanks

If you say file attached are you referring to files added as Resource file within your project or? I couldn't open your file due to that I'm currently using VS2010 and you used VS2015.

Hi Mr.M

I see you are willing to help..
I have attach only xml file to show example file from which I should export data and make some kind of report to print them.

If you know how to do this ( app to go through XML and collect fields & make new wordpad with collected data) , I can install VS2010 if neccessary (no diference to me because I don't know how to use any of them).

for example

<Place_of_declaration>
<null/>
</Place_of_declaration>
<Date_of_declaration/>
<Selected_page>1</Selected_page>
</Property>
<Identification>
<Office_segment>
<Customs_clearance_office_code>CD000000</Customs_clearance_office_code>
<Customs_Clearance_office_name>Virtuelna kancel. za odlo┼żene proce</Customs_Clearance_office_name>
</Office_segment>
<Type>
<Type_of_declaration>
<null/>
</Type_of_declaration>

if I click on button report1

wordpad gives me report1
CD000000

if I click on button report2

wordpad gives me report2
1 & CD000000 & Virtuelna kancel. za odlo┼żene proce

This article has been dead for over six months. Start a new discussion instead.