|
dirsow wrote: 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[^]
|
|
|
|
|
I forgot to put the error message:
Quote: 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
Thanks,
Dirso.
|
|
|
|
|
Ah, you'll need to add a reference indeed, particular to the project it is mentioning. You're using that form from another assembly, and the assembly it's contained in is not loaded on default.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi!
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.
|
|
|
|
|
Do your "special forms" use a different namespace? What about
TheNamespace.FrmRequestPwd.Show(true, "Solicite uma senha ao seu representante!");
|
|
|
|
|
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
Thanks and Regards
S.Somu
7639245585
|
|
|
|
|
"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.
|
|
|
|
|
Why four, and not five?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Heck, let's be generous and let him have 6!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
can you please help me on how to display all the tables on your database on the listbox?
|
|
|
|
|
You can use SMO[^] to read (and manipulate) the structure of your database.
/ravi
|
|
|
|
|
Half the answer[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Execute below sql query agianest your database. It will retrieve all the tables availabale in the database you are using.
SELECT DISTINCT TABLE_NAME FROM information_schema.tables order by TABLE_NAME
Bind the resulted tabel to List box item
ListItem listImet;
lst.Items.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
string Text = dt.Rows[i]["TABLE_NAME"].ToString();
listImet = new ListItem(Text);
lst.Items.Add(listImet);
}
Paly
|
|
|
|
|
Background:
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?
Example:
Assembly LocalizationTools.dll
namespace LocalizationTools
{
public class LocalDisplayNameAttribute : DisplayNameAttribute
{
public LocalDisplayNameAttribute(string resourceName, string defaultText)
: base(defaultText)
{
m_resourceName = resourceName;
}
public override string DisplayName
{
get
{
string name = string.Empty;
try
{
name = SomeVodoo(base.DisplayNameValue);
}
catch (Exception)
{
name = base.DisplayNameValue;
}
return name;
}
}
private string SomeVodoo(string defaultText)
{
}
}
}
Assembly SomeClasses.dll
public class Foo
{
[LocalizationTools.LocalDisplayName("DisplayName_ImportantProperty", "Important property XYZ")]
public int ImportantProperty { get; set; }
}
And in SomeClasses.Properties.Resources you can find DisplayName_ImportantProperty
PS: I have a IMO less elegant solution by declaring the type.
[LocalizationTools.LocalDisplayName(typeof(SomeClasses.Properties.Resources), "DisplayName_ImportantProperty", "Important property XYZ")]
public int ImportantProperty { get; set; }
}
Thanks in advance
Andy
|
|
|
|
|
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.
|
|
|
|
|
Hi Dave,
thanks for your answer.
Well, I did not want to change the behaviour of the attribute. It still should show the DisplayName, Description, Category etc. I only wanted to make it a bit more "smart" regarding localization.
I was just curious, if it is possibly for an attribute to figure out to which class it is attached.
It's ok for me, since I have a solution, inspired by different approaches which can be found here at CP and out in the web.
|
|
|
|
|
I'm fairly sure you can't do this without using a typeof(...) to pass it to the attribute's constructor.
|
|
|
|
|
Thx for your answer.
Well, I have to accept my destiny and I'll choose the typeof operator in the constructor.
As I mentioned before, I was just interested if it could be possible
|
|
|
|
|
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];
return obj;
}
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.
|
|
|
|
|
Hashtable hashtable;
private void button1_Click(object sender, EventArgs e)
{
Test t1 = new Test();
t1.variable = 1;
Test t2 = new Test();
t2.variable = 2;
hashtable = new Hashtable();
hashtable.Add(1, t1);
hashtable.Add(2, t2);
Test tc1 = GetClass(1);
tc1.ShowVar();
Test tc2 = GetClass(2);
tc2.ShowVar();
}
public Test GetClass(object id)
{
return (Test)hashtable[id];
}
}
public class Test
{
public int variable;
public void ShowVar()
{
Console.WriteLine(variable);
}
}
|
|
|
|
|
Can you post the code using the function FndObject?
The code you posted above doesnt seem to have any problems.
|
|
|
|
|
Why are you creating a new ClassName instance when the variable obj id immediately overwritten in then next statement?
The next thing you don't understand is that trying to retreive a an object via a key from a Hashtablehttp://msdn.microsoft.com/en-us/library/system.collections.hashtable.item(v=vs.80).aspx[^] will return null when there is nothing stored under that key:
MSDN wrote: 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.
Regards,
— Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Furthermore, the element at nKey may not be of type ClassName or a derived class - then the cast to ClassName will change it to null.
|
|
|
|
|
Hi can anybody plesae tell me is there any opensource BPM for .net rather than www.netbpm.org......
Thanks in advance
modified 5-Oct-12 2:36am.
|
|
|
|
|
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|