Solved

c# locate resource file

Posted on 2011-03-01
4
374 Views
Last Modified: 2013-12-17
Hi,
I develop my app on eg. f:\myapp\ where I save my resource file in the app.conf where
I indicate my resource file location as f:\myapp\resources\res.bin.
When I copy my program to other computer and run on c:\ drive. The program coult not start because it is looling for f:\ drive. How can I solve this issue?

Thanks,
JT
0
Comment
Question by:jtran007
  • 2
4 Comments
 
LVL 8

Assisted Solution

by:crysallus
crysallus earned 200 total points
ID: 35014788
To specify the file resources\res.bin relative to the location of the executable, use:

Application.StartupPath + Path.DirectorySeparatorChar + "resources" + Path.DirectorySeparatorChar + "res.bin"

Open in new window

0
 
LVL 7

Accepted Solution

by:
mkobrin earned 300 total points
ID: 35014794
Go to the properties of your resource file in you Visual Studio IDE and set the option to copy the resource locally and then recompile the code. The resource file will then be local, and you will not have to another drive to find it.
0
 

Author Comment

by:jtran007
ID: 35023702
HI,

But what is the syntax to open this file? ".\resources\res.bin"

Thanks,
JT
0
 

Author Closing Comment

by:jtran007
ID: 35380741
Thanks,
JT
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now