?
Solved

Specify installation directory.

Posted on 2009-05-06
3
Medium Priority
?
164 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 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 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