473,765 Members | 2,224 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.IO.FileN otFoundExceptio n error when accessing My.Resources

sh
I have a resource called "Location". When I try to access it with the
statement

If My.Resources.Lo cation = "Office" ...

I get the following error message:

A first chance exception of type 'System.IO.File NotFoundExcepti on'
occurred in mscorlib.dll

Why? Isn't the resource part of the application?

How can I avoid this error (except with a Try...Catch statement).
Jul 30 '07 #1
1 2770
Tom
You cannot use that statement, because Resources are read-only.

My.Resources.Lo cation should be your resource and remember to use the
data as its meant to (Dont try stupid things like msgbox'ing a bitmap
like i have done in the past).

If you want to have something be able to change, add it to the Settings
instead.

sh wrote:
I have a resource called "Location". When I try to access it with the
statement

If My.Resources.Lo cation = "Office" ...

I get the following error message:

A first chance exception of type 'System.IO.File NotFoundExcepti on'
occurred in mscorlib.dll

Why? Isn't the resource part of the application?

How can I avoid this error (except with a Try...Catch statement).
Jul 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6704
by: ulf | last post by:
Hello, After I got a FileNotFoundException in my real life CSharp code, I nailed it down to the following line: System.EnterpriseServices.ResourcePool rp = new System.EnterpriseServices.ResourcePool(null); The exception I get for this line is System.IO.FileNotFoundException: The specified module could not be found.
2
6826
by: Chris Aitchison | last post by:
Hello, I am attempting to have a class that I have written serialize so that it can be both passed as a parameter or return value for a webservice, and also be serialized to disk using the XmlSerializer. When this class is decalred as a return value for a WebMethod in an XML WebService I receive the following exception: System.IO.FileNotFoundException: File or assembly name rexz5r1o.dll, or one
4
6338
by: Ram | last post by:
Hey, I have a Com+ application (Inherits ServicedComponent). In this application, I needed to use one of the ADSI's COM Object, \ So I used the - TlbImp.exe. After I created the Tlb dll, I gave it a StrongName, and installed it in the GAC. In my Com+ Application, I added a reference to the Tlb dll. The proble is, that when I try to instatiate an object of this type, I keep getting this weird Exception saying:...
2
2227
by: Raja | last post by:
I am trying to access files in a remote server from my ASP.NET application, it is giving System.IO.FileNotFoundException error. I tried mapping that server location like "H:\ErrorLogs\error.log" still it gives error. I tried even giving the server name and directory like "\\server_name\\Directory\\file.log" still it gives file not found exception. Does anyone help me fix this. Thanks
3
5006
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
1
7148
by: kkizer | last post by:
I have a problem with this simple code below. Moving the files works perfectly, but once in a blue moon the file that it is trying to move dissapears before it can move it. and when this happens the "System.IO.Move" goes in to a loop and keeps creating the file on the destination folder with a 0byte size and keeps entering the error in the log i have until someone stop the service. so what i cant figure out is since it catches the...
2
7953
by: jjlagtap | last post by:
Hey everyone When I try to open a file i get the Exception listed below. The weird thing is it works when I run the web app locally and when i use a remote server and open a file on my computer. When someone else uses the web app and tries to open a file using the remote server the error below happens. any help? **Code** C# - filepath is a valid file name which is passed via the form. System.IO.BinaryReader br = new...
2
11019
by: =?Utf-8?B?c2FtMDFt?= | last post by:
I have a remoting application that was developed on a Windows XP SP2 machine with VS2005 SP1. I finally got everything deployed using Wix 3.0, and it works great. Problem is, when I install the msi on a W23 server SP2, I get the following error: System.Runtime.Remoting.RemotingException: Remoting configuration failed with the exception 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation....
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.