?
Solved

c# locate resource file

Posted on 2011-03-01
4
Medium Priority
?
381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Assisted Solution

by:crysallus
crysallus earned 800 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 1200 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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 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