Solved

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

Posted on 2009-07-07
1
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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