Solved

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

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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