Solved

Specify installation directory.

Posted on 2009-05-06
3
156 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

785 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