• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

Specify installation directory.

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
StanT
Asked:
StanT
  • 2
1 Solution
 
oobaylyCommented:
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
 
oobaylyCommented:
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
 
StanTAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now