I made a software with several forms and a few of them have a private constructor and a public static method that is responsible for creating, initializing and showing it. Everything works fine within this application, but now I made another desktop application and I added a reference in this new application to the old one, so I could reuse all forms. Well, every form I call the constructor directly works fine (mdi forms for example), but those "special" classes with private constructors give me an error compiling in release mode, but weirdly it compiles fine in debug mode... Any ideas?
that's how i call
FrmRequestPwd.Show(true, "Solicite uma senha ao seu representante!");
but those "special" classes with private constructors give me an error compiling in release mode, but weirdly it compiles fine in debug mode... Any ideas?
Compiles fine for me. What did the error say exactly? The message might be kinda helpful. FWIW, debug and release-mode follow the same rules, unless you have some preprocessor-directives in there. I don't see any in this code, so I'm curious about the description of the error you'd get.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
Error 118 The name 'FrmRequestPwd' does not exist in the current context C:\DADOS\SuperControle\Projects\NewSuperControle\SuperControle\Softwares\Appls\SuperControle.Appls.SuperSPED\FrmSuperContabil.cs 95 21 SuperControle.Appls.SuperContabil
Actually I already did it. I have the reference removed and added again to be sure, but still the same error. there are at least 100 forms in the reference and I use most of them in this new application and the error occurs only with 2 of them, but the weirdst part is in debug mode it works like a charm.
I have already working single tier and three tier application . but i want to create a four tier application in my project solution using C# .If you know any one person this details Plz Send me solution of procedure
"Tiers" are not a procedural thing. It's a way of thinking. It's organizing your code for seperation of concerns based on the requirements and design of your application. You cannot learn this by looking at someone elses project.
To implement localization I have derived from DisplayNameAttribute: LocalDisplayNameAttribute. When using this attribute, I only want to declare the ResourceString an a default string. The class LocalDisplayNameAttribute should find out on it's own, which class and which assembly is using it.
My idea is, to find the strings in related resources by reflection. The strings should allways be in AssemblyName.Properties.Resources.
Is it possible for a attribute class, to find out, who it is used by?
publicclass LocalDisplayNameAttribute : DisplayNameAttribute
public LocalDisplayNameAttribute(string resourceName, string defaultText)
m_resourceName = resourceName;
string name = string.Empty;
name = SomeVodoo(base.DisplayNameValue);
name = base.DisplayNameValue;
privatestring SomeVodoo(string defaultText)
// Find out to which class an assembly we belong. Then Find the Properties.Resources of the assembly
// and find the m_resourceName
You don't. An atribute should NOT EVER modify its behavior based on the class name it's attached to. The reason is that now your attribute functionality is directly tied to the classes it's looking for. That's bad!
If you need to modify the behavior of the attribute, then you need two or more attributes, one for each behavior.
Hello. I am using a hastable to store and retrieve class objects. Now I can successfully get an object based on some key but the problem is: I can not return it from within the function. Here is what I am trying
public ClassName FindObject(int nKey)
ClassName obj = new ClassName();
obj = (ClassName)HashTable[nKey];
Now the line (ClassName)HashTable[nKey] is successful to find the required object but obj is still equal to null. Thanks for any input on this.
This world is going to explode due to international politics, SOON.
The value associated with the specified key. If the specified key is not found, attempting to get it returns a null reference (Nothing in Visual Basic), and attempting to set it creates a new element using the specified key.
So what happens here is that whatever you passed into FindObject as a key has no instance of type ClassName associated with it.
"I had the right to remain silent, but I didn't have the ability!"