|
There can possibly be three reasons (however, in your problem, reason No. 1 below is more probable) for the problem:
1. The default resource file should be in your main assembly. When you use the following code:
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DetailsActions));
the resources are not found in the assembly in which they are being searched. However, when you are giving the details of the assembly in which the resources are available (as well as when you are giving the full qualified path of the resource by providing “RDC.controls.DetailsActions ”) by way of the following code:
System.Resources.ResourceManager resources = new System.Resources.ResourceManager("RDC.controls.DetailsActions", System.Reflection.Assembly.GetExecutingAssembly());
the search for the resource concerned is conducted in the right assembly whose details are now available in the command System.Reflection.Assembly.GetExecutingAssembly() .
So, basically it is a question of giving the default name and path vis-à-vis the fully qualified name and path . When you supply the fully-qualified name and path, the resource can be located, whereas with the default name and path the resource cannot be found.
2. The resource is marked as private. This is what MSDN describes: Resources marked as private are accessible only in the assembly in which they are placed. Because a satellite assembly contains no code, resources private to it become unavailable through any mechanism. Therefore, resources in satellite assemblies should always be public so that they are accessible from your main assembly. Resources embedded in your main assembly are accessible to your main assembly, whether private or public.
3. The third reason could perhaps be when you are using satellite assemblies for different cultures and when you are not providing the correct path for the resource for the particular culture being used. However, apparently this is not your problem, because your problem is getting resolved when you provide the fully qualified name and path.
So, apparently the answer to your problem lies in the reason No. 1 above. To ensure that the problem does not occur, be sure to keep the resource at the appropriate place in a conscious manner and give full name and path.
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
|
|
|
|
|
Thanks for this detailed answer. There are a couple of problems though
1. This resource is created by Visual Studio, and I've never moved it
2. I do not support more than one language in my application
3. Because it's loaded in the InitializeComponent method, I am powerless to stop the IDE from changing that line of code, every time I edit the form.
I'll check if it's been marked private, do you have any other suggestions ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What appears to me is that when the default ResourceManager method with one parameter, i.e., ResourceManager(typeof(DetailsActions)) is called, it is getting called in the correct assembly (i.e., "RDC") because the error mentioned by you clearly shows the name of the assembly being searched, i.e.,
"Make sure "DetailsActions.resources" was correctly embedded or linked into assembly "RDC"."
So, when you compare the aforesaid single-parameter ResourceManager method with the two-parameters method namely ResourceManager("RDC.controls.DetailsActions", System.Reflection.Assembly.GetExecutingAssembly()) , it appears that the assembly is being identified correctly. The only problem is that the call to typeof(DetailsActions) is resulting into something like "DetailsActions " instead of resulting into the required fully qualified Namespace / path of "RDC.Controls.DetailsActions ". So, perhaps what is required to be done is that when the InitializeComponent method of the user control is called for the purpose of constructing the embedded resources, it should make typeof(DetailsActions) to produce fully qualified Namespace / path of "RDC.Controls.DetailsActions ". So, I wonder whether the Namespace mentioned in the source file containing the user control can be changed to the fully qualified Namespace of "RDC.Controls.... " if it is not so already and whether it helps in solving the problem. If it does not help (unfortunately I cannot visualize your actual code), you may please try to somehow ensure that the typeof operator when run on the class of user control returns the full Namespace path. This problem might perhaps have arisen due to the user control having been initially designed in one environment and then the same being copied to a different solution leading to conflict of namespaces.
As an alternative, you may also try changing the default namespace to the fully qualified namespace (if not so already) in the properties of the project containing user control.
I can only hope that it works.
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
|
|
|
|
|
In my application I am using a StatusBar of which I need to change Icon dynamically on different event. I did something like this:
Icon redIcon = new Icon(@"C:\Documents and Settings\Me\My Documents\Visual Studio Projects\Invoices\Icons\Red_light.ico");
statusBarPanel1.Icon = redIcon;
But when I tried to deploy this application the package and deployment wizard did not include the folder under my solution. So, when I installed it to any PC other then mine, I got an error:
Could not find a part of the path "C:\Documents and Settings\haider\My Documents\Visual Studio Projects\InvoiceQueue\Icons\Check.ico
How can I use these Icon files that my setup project includes it.
Also lets assume that I included these files in my setup project but how would I know the path of that Icon folder because right now I am hardcoding the location but user may change the location of installation etc.
In ASP.NET we used Server.MapPath but how or what technique I need to use in Windows Applications? Thanks a lot for your time in advance.
Best Regards,
Rob
-- modified at 16:48 Wednesday 14th September, 2005
|
|
|
|
|
Hi Rob,
you have two choice, either embed the icons as resources or include them as content.
If you use the content, I cant remember the syntax in c# but for vb.net it would be something like:
dim redIcon as new Icon = Application.startuppath & "\red_light.ico"
Check the help in VSS quickly, or look on here for the conversion to c#. Very simple.
Andy
|
|
|
|
|
As the other reply suggests, I would rather embed the resources in the assembly. Add the icon to the project in Solution Explorer and in the property window, select Embedded Resource instead of Content.
And in code, use something this constructor[^]:
Icon icon = new Icon(GetType(), "IconName.ico"); I hope this helps!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hi
I have a status bar in my main form. This status bar displays different text. I need to display a tooltip with a text (on mouse over) if the text is too large to fit into the status bar - if it's not completely visible (similar functionality as in Visual Studio). How do I determine if the length of the text string is larger than the current width of the status bar panel? I currently use Graphics.MeasureString method, but results are not consistent.
Thank you in advance
|
|
|
|
|
Results are not consistent because of different font types.
You might like to use system font.
- ashish
|
|
|
|
|
Somebody was telling me that Steve Ballmer(sp?) said that the .net platform wasnt going the way that MS wanted it to go and that it wont be around for much longer.
Anybody else heard anything about this?
|
|
|
|
|
Daniel1324 wrote:
Anybody else heard anything about this?
Nope.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
.Net is here to stay. Need some alternative to Java.
|
|
|
|
|
Daniel1324 wrote:
Somebody was telling me that Steve Ballmer(sp?) said that the .net platform wasnt going the way that MS wanted it to go and that it wont be around for much longer.
Anybody else heard anything about this?
Somebody is winding you up. .NET is here to stay. The new WinFx framework is built on-top of the current .NET implementation. C#, managed code and all the other goodies that came with .NET are continuing to evolve and are now central to Microsoft's developer strategy.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Daniel1324 wrote:
Somebody was telling me
Who, a Java guy?
I cannot take anything the Bush administration does seriously. The corruption, the cynical disregard for humanity, the cronyism and incompetence, all wrapped in a slimey flag of ultra-marketed nationalism repulses me. -- consdubya from fark.com.
|
|
|
|
|
Actually, he works for a company that uses java. Good call!
|
|
|
|
|
It's a pile of absolute crap.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Always turn to CG if you're looking for an honest, to-the-point answer.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
I bet this "Somebody" has lots of fun with you.
Somebody: Hey, did you know there is no 'G' in the word gullible? :->
You: Really?
Somebody:
Matt Gerrans
|
|
|
|
|
Piss off dickhead.It was just a comment in a passing conversation.
|
|
|
|
|
I don't think this is appropriate language for this kind of discussion board! You should refrain from posting until you learn to control yourself!
mav
|
|
|
|
|
Why dont you edit my post then.
I dont like being called gullible either. I didnt say I believed him, I just asked a question here.
|
|
|
|
|
I need to be able to conditionally compile some code based on the compiler version, but I've been unable find any compiler defined symbols let alone something with the compiler version. If anyone know where these are defined I sure would appreciate you letting me know. Thanks
|
|
|
|
|
C# doesn't have any predefined symbols. There is nothing that specified the version of the .NET Framework or compiler version at compile-time. Also, macro's using the preprocessor directives are not supported. This is because there is no real preprocessor in the C# compiler, it's kind of "simulated".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi!
I wanna simulate keypress in a directx application.
I thought I'd use PostMessage for this, but how can I get it's handle? There's no caption, so FindWindow
doesn't work, and because it's a fullscreen application, I can't get the handle
with spy++ neither.
Any1 knows any way to do this?(without using applications that put it into a window)
Thanks
-- modified at 14:53 Wednesday 14th September, 2005
|
|
|
|
|
Hello,
I am trying to make a program where I can get curve data points after placing a few points on screen and having the Windows GDI Draw a curve from those few points. I already have the program done to the point where I can place points and draw a curve, but now I want to be able to get the data of many points on that drawn curve. So if I place five points, and let the GDI draw the curve I would like to be able to get around 100 data points that lay on that curve. Does anyone know where I could get this functionality in C#. I have been searching online for a while. I wish the GDI would just have a function where I could just get all the points it uses to draw the curve but I don't think that is built in.
Thanks for your help,
Michael Brown
|
|
|
|
|
need to split into an array string where delimeter is "ftp://";
(please note that I can not change
"ftp://" to single char, and I have no idea how many ftp sites there might be
to extract, could be one, could be 100's or 1000's)
|
|
|
|