Solved

Load user control (which acts as menu) from different XML files

Posted on 2009-07-07
1
245 Views
Last Modified: 2012-06-27
I need a way to find the xml file which is located in  the currect directory
(please see the screenshot)

now for folder NMI > zzObject.xml (contailns sitemap )
similarly and each folder has its own .xml file

now I have a user control which acts as a menu and that menu needs to be based on the xml file
So,
1. how does the user control know which page is using it
2. how does the user control acess the .xml file fom the directory where the page which has been loaded and then use it.
screenshot.jpg
0
Comment
Question by:manivineet
1 Comment
 
LVL 18

Accepted Solution

by:
vbturbo earned 500 total points
ID: 24804918
Hello manivineet

Well there a multiple solutions to your issue and one of them is recursion

DirSearch(C:\)

Private Sub DirSearch(ByVal sDir As String)
        Try
            For Each f As String In Directory.GetFiles(sDir, txtFile.Text)
               lstFilesFound.Items.Add(f)
            Next
            For Each d As String In Directory.GetDirectories(sDir)
                DirSearch(d)
            Next
        Catch excpt As System.Exception
            Console.WriteLine(excpt.Message)
        End Try
    End Sub

another one is to select a relative path and use the above recursive function

Dim execName As String = Assembly.GetExecutingAssembly().GetModules()(0).FullyQualifiedName
Dim currentFolder As String = System.IO.Path.GetDirectoryName(execName)
Dim _path As String = System.IO.Path.Combine(currentFolder.Replace("bin\Debug", ""), "Meter\NMI\")

/vbturbo
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now