Solved

Specify installation directory.

Posted on 2009-05-06
3
158 Views
Last Modified: 2013-11-26
Hi Experts,

I was wondering how to tell a program to look in the installation directory for a file.

Glass.WriteXmlSchema("INSTALLATION PATH"\DemoSchema.xsd")

Thanks, Stan
0
Comment
Question by:StanT
  • 2
3 Comments
 
LVL 15

Expert Comment

by:oobayly
ID: 24320046
Use the Assembly information & the Directory Info
Imports System.IO
Imports System.Reflection
 
Public Sub Foo()
  Dim executingPath As DirectoryInfo = New FileInfo(Assembly.GetEntryAssembly().Location).Directory
  Dim schemaName As String = "DemoSchema.xsd"
  Dim schemaPath As String = executingPath & "\" & schemaName
End Sub
sibg

Open in new window

0
 
LVL 15

Accepted Solution

by:
oobayly earned 125 total points
ID: 24320097
Sorry, should have used the FullName property. The previous code compiles but I don't like implicit casts.
Imports System.IO
Imports System.Reflection
 
Public Sub Foo()
  Dim executingPath As DirectoryInfo = New FileInfo(Assembly.GetEntryAssembly().Location).Directory
  Dim schemaName As String = "DemoSchema.xsd"
  Dim schemaPath As String = executingPath.FullName & "\" & schemaName
End Sub

Open in new window

0
 
LVL 4

Author Comment

by:StanT
ID: 24335695
Thanks, that worked....although I ended up going with a different route. I placed all my files on a server share. That way I don't have to recompile everytime i needed to change a form.
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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