Solved

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

Posted on 2009-07-07
1
246 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

947 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

19 Experts available now in Live!

Get 1:1 Help Now