|
Thx
Problem was solved. (I had to change a name of config file).
Tomiga
|
|
|
|
|
Ok, I have been messing around with C# lately and am trying to use one of the controls I found here (Carlos's Outlookbar control). I am running into problems using his resX files in my app for some reason. I keep getting the following error when I try to run:
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "IconImages.resources" was correctly embedded or linked into assembly "csharp_OLApp".
baseName: IconImages locationInfo: <null> resource file name: IconImages.resources assembly: csharp_OLApp, Version=1.0.907.40862, Culture=neutral, PublicKeyToken=null
Now here are the particulars:
My app's namespace: csharp_OLApp
Old app's namespace: Demo
resX filename: IconImages.resX
Code @ the exception:
Bitmap icons = (Bitmap)rmListImages.GetObject("ListIcons");
Code that loads the resource in my app:
Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("csharp_OLApp.Form1"));
rmListImages = new ResourceManager("IconImages", thisAssembly);
rmBitmaps = new ResourceManager("Menus", thisAssembly);
Code that loads the resource in the old app:
Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("Demo.Form1"));
rmListImages = new ResourceManager("IconImages", thisAssembly);
rmBitmaps = new ResourceManager("Menus", thisAssembly);
Now, I have tried everytrick in the book here to try to get this to work. I have fiddled with every project paramter I could find reference to in every Usenet and web-board post I could find. I can not get this to work. I have loaded the resource editor in hopes that I could maybe spot old rements of the root namespace from the old 'Demo' app but I can;t seem to loacte that anywhere inside the resX file. The other thing I can not figure out is why the exception text points to a .resource file!
If anyone can lead me to a solution I would be GREATFULL
Can someone please help out before I loose what is left of my hair!
|
|
|
|
|
O,, I have done some more diging. I pulled up my copy of Reflector (Lutz Roeder) and noticed that same resource file in the origonal application that it was used in was listed as:
IconImages.resources
(note that it does not seem to include the root namespace of the application 'Demo' in this case)
I looked at the IL for my app and noticed that the same file was listed as:
csharp_OLApp.IconImages.resources
(note that for some reason this includes the rootnamespace of my application 'csharp_OLApp' in this case)
I changed the line that attemptes to load the images fro the resource manager that I created by including my application root namepsace as so:
Bitmap icons = (Bitmap)rmListImages.GetObject("ListIcons");
and now it seems to work.
My big question is WHY the heck did I have to include the namespace?
|
|
|
|
|
I found it interesting that when I created a Window Form in C#, the IDE hardcoded things like position and size of the controls in the code itself. Why? I never liked the RC file anyways, mainly because I thought it could do a lot more than it did (I ended up rolling my own for my own applications!). But to completely get rid of it seems like taking a big step backwards.
Sounds like someone (maybe me) should write a class that reads an RC-like file and creates the form/controls. And if the class were abstracted, able to generate Window Form and Web Form controls, then you could have one control file for both presentations. Does this sound reasonable?
Any comments/thoughts about the lost RC file?
Marc
|
|
|
|
|
I've seen a sample on GotDotNet that does this with XML. Its definetly not production grade but its a proof of concept. It can be done!
|
|
|
|
|
What's the rational behind this?
Marc
|
|
|
|
|
I beleive the thinking behind this was that Structs tend to be more "Light-Weight" than classes.
|
|
|
|
|
Stack is stored in stack, and Class in heap
Stack never grows, but heap can do.
I'm amumu, and you?
|
|
|
|
|
Did you mean "struct" is stored in stack?
I read somewhere on CP that you can explicitly allocate things on the stack also, so I think stacks can grow. I can't think of a good reason right now to do this, but you never know...
Marc
|
|
|
|
|
Marc Clifton wrote:
you can explicitly allocate things on the stack
This might be along the lines of being able to position things in memory within the struct.
I've seen some code examples and they seem to make use of attributes to pull this off.
Can't see a reason for this, although this might be to allow some interop with C++.
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
for the clr, the decision of whether a class is stored on the stack or the heap has been shifted from the consumer of the class to the developer of the class.
an exception is that the consumer of a ValueType ( class stored on the stack ) can "box" the ValueType, which allows her to treat the ValueType as an Object on the heap. I believe this is done by putting a pointer to the ValueType on the heap.
however, you can't put a reference object on the stack.
|
|
|
|
|
I read it from "Professional in .Net framework".
I'm amumu, and you?
|
|
|
|
|
I just read that C# doesn't support global variables. What does everyone think about that? Do you feel that this limits C# to small scale applications, or do you think that static variables in the "main" class can "replace" global variables? What about some sort of global variable management container?
Marc
|
|
|
|
|
Its not as bad as you think, after a while you'll get out of the mindset of wanting to use globals. It promotes good OO design. Hell, academics have been saying globals are the work of the devil since the early days of structured programming.
In cases where globals would be appropriate you can just make a class with static members. However I rarely find myself doing that.
|
|
|
|
|
True, but like most other things, the difference between academia and the real world is like night and day. So static members are a "workaround" to the global problem (is there a pun in that?)
What about messaging? While the whole GUI event architecture in Window Forms is now changed to use delegates instead of messaging, there doesn't seem to be any support for messaging (well, there's the System.Messaging stuff, but that's way overkill for simple intra-application messaging). I've seen a lot of C++ apps that use custom messages for notifications, etc. Is this whole concept easily converted to delegates?
Thanks for your reply. I'm trying to dig into some of the differences in C# vs. C++ design.
Marc
|
|
|
|
|
Right, System.Messaging is intended for Multi-server messaging. Its the .NET wrapper for MSMQ. As far as delegates go I believe they can be used as a replacement for many custom message scenarios. Of course they can't replace it entirely, most of the Events from System.Windows.Forms are generated in direct response from Windows Messages.
In addition, .NET does provide for generating and processing messages directly. All objects that are associated with an HWND have an overridable WndProc which is a slightly abstracted WindowProc. You can also use all the native API functions for registering custom messages and Posting messages to other windows.
Now keep in mind I'm not trying to argue that .NET (C# in this case) is ssooo much better than Win32 C++ design. I'm just pointing out (what I think at least ) what the .NET developers have done as alternative solutions to these common tasks that seem to be missing from the framework and C# language.
|
|
|
|
|
Hi
I'd like to invoke member function e.g. from System.Windows.Forms.Button. I found some article in MSDN for System.Int32 that works well but for class Button no :/
Type myType1 = Type.GetType("System.Int32"); // OK
Console.WriteLine("The 'Fullname' is {0} ",myType1.FullName);
Type myType2 = Type.GetType("System.Windows.Forms.Button",true); // ERROR ? WHY ?
Console.WriteLine("The 'Fullname' is {0} ", myType2.FullName);
myType2.InvokeMember(....);
Is possible in this case ?
Wizard_01
|
|
|
|
|
From MSDN docu:
"If typeName includes only the name of the Type, this method searches in the calling object's assembly, then in the mscorlib.dll assembly. If typeName is fully qualified with the partial or complete assembly name, this method searches in the specified assembly."
Since you're only specifing the type name, it looks in your assembly, can't find it then looks in mscorlib. System.Int32 is defined there but System.Windows.Forms.Button isn't. Thus the error.
This however, will work:
Type myType2 = Type.GetType("System.Windows.Forms.Button,"+Assembly.LoadWithPartialName("System.Windows.Forms").FullName,true);
or the much simpler
Type myType2 = typeof(System.Windows.Forms.Button);
|
|
|
|
|
Thank you
Could you tell me who can I now create new Object from 'myType2' ?
Wizard_01
|
|
|
|
|
Activator.CreateInstance(myType2);
|
|
|
|
|
Has anyone got sample code of using Oracle and .NET?
I'm specifically looking for the syntax of calling a stored proc and receiving a result set.
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
oracle has recently released a beta version of their managed data provider. It comes with fairly extensive help files.
You may want to look into using that instead of the OleDb data provider.
|
|
|
|
|
I'm looking at the site now.
Any idea if there's truth to the rumor that Oracle can't return a recordset from a stored proc. to ADO?
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
Hi All,
I'm having a small problem with my C# application.
I have a DLL written a while ago, using pure Windows API. Now, it would be really nice if I could call functions of that DLL from my C# application.
Any ideas how I might go about it?
Any help would be appreciated.
Regards,
Venet.
--------
Black holes are where God divided by zero.(Steven Wright)
|
|
|
|
|
i'm not an expert in dll-including, but i once took a function out of an ordinary dll like this:
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
and just used it.
that was all
:wq
|
|
|
|