|
Either keep the Unregister, or implement IDisposable with an if(registered) Unregister(); pattern.
If you really, really, really want to get rid of this unregister then I suggest you try to knock up a generic event proxy that uses weak references to refer to the observer, and can unregister and drop itself when the weak reference goes dead.
|
|
|
|
|
Hello,
thank you very much for your answer. The solution with a weak reference was already implemented and it is good to know that it was not only the outcome of a "disperate" programmer (...me). The problem is that some subscribers should survive when they are reacheable directly (not only through the event) so the client should provide that kind of information. Again the client has to think about memory management somehow. It would be perfect to be able to find out where the instance (subscriber) is referenced and check if only the events are keeping it alive. In case of other references the proxy could be restored. But I don't know how (and if it is possible). Anyway you gave me the courage to keep "Unregister" or the like...and this is big value.
|
|
|
|
|
Here is an excellent article about this topic published on codeproject recently: Weak Events in C#[^]
|
|
|
|
|
Thank you very much. That's the kind of information I was looking for. Also refering to another answer, now I know how the proxy was meant (and that was NOT the way I implemented killing any possible new idea...)
|
|
|
|
|
You are welcome
|
|
|
|
|
Hello
I have a column in crystal report which can display both float values as well as integer values...
Using formatting i set the decimal notation as 000.000 it is working fine for float.. but for integer values also it displays decimal part (like 5.000) I want it to be displayed like an integer 5
Any options available in reports/??
Thanks in Advance...
Salai
|
|
|
|
|
You set a formula to the number of decimal places in number Custom Style dialog.
In that formula you resolve if the number is integer or float. If it's an integer you return 0 (meaning no decimal places) and if it's a float you return 3 if you want three decimals.
Another option is to create a new formula field and use type conversion functions etc such as CStr. Then place this field into the report.
The need to optimize rises from a bad design
|
|
|
|
|
Mika....
Thanks it worked fine...
Thank you so much
Salai
|
|
|
|
|
You're welcome
The need to optimize rises from a bad design
|
|
|
|
|
Hi all,
I am migrating a C++ application to C#. One of the classes can read/write DBF (dBase) files.
The question is:
Does it worth to migrate this class?
What are all the ready-made .net alternatives?
Do these alternatives have some deployment requirements?
Thanks in advance.
Best regards,
Jaime.
|
|
|
|
|
This might be able to help you: http://www.codeproject.com/KB/bugs/LoadDBF.aspx[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Some comment there confirm my concern:
From article: However, try to find one that does not use the MS Jet driver or perhaps the MS FoxPro driver. I tried myself and couldn't find one
So, I think I will use my own library, that doesn't need to load the entire table into a datatable. Thanks for the link.
Best regards,
Jaime.
|
|
|
|
|
Hi...
I have a value in oracle DB like "3.50324616E-38"..
when I read this value from db in Vc.net using odbcDataReader I get an error like
"Value was too large or small for a decimal"..
The error is encountered in thi line
varname = RdrIns->default::get(row+icnt) ;
i tried many methods of Datareader..like .Getint32, GetInt64 GetDecimal etc..
no use
any help.???
Salai
|
|
|
|
|
Did you try a double?
led mike
|
|
|
|
|
Yaa I tried....
tried all the methods supported by the OdbcDataReader...
Salai
|
|
|
|
|
It doesn't work because of exactly what the error message says. The smallest value a Decimal type can have is (+/-)1E-28. You're trying the move the decimal point 10 places more to the left than the Decimal type can handle.
|
|
|
|
|
Thanks Dave...
I understud... Is there any other method to handle this data.. The datatype of that column in Oracle is Binary_FLoat. While oracle can store that data why cant .Net access that data??.. I tried with
Rdr->GetData
Rdr->GetDecimal
Rdr->Getint16,32
Rdr->GetDouble
Rdr->GetFloat
etc....
Nothing works...
Salai
|
|
|
|
|
salaikumar wrote: While oracle can store that data why cant .Net access that data??
Was .NET written by Oracle?? No. There's nothing that says Microsoft has to support every feature of every database or anything else that might come .NETs way.
You have to use the Double data type to store the value. It's range is (copied from MSDN documentation):
-1.79769313486231570E+308 through -4.94065645841246544E-324 † for negative values;
4.94065645841246544E-324 through 1.79769313486231570E+308 † for positive values
|
|
|
|
|
Thanks Dave..
When I tried with double, it returns error for other columns..(Since it is a generic function). Atlast I handled this problem by having a try catch with over flow exception and replaced this value with zero to display in reports since this value is very small.. Thanks for your concern to reply.
Salai
|
|
|
|
|
Hi All,
I am learning to use the Unit Testing features in Visual studio team system 2008 for C# projects.The book(Pro Visual studio 2005-Apress) i am reading says to open the "Service Class " to generate the Unit Test.But i cannot seems to know how to do it.
I serached and in am unable to get an answer.Any person out there who havve used Unit testing or made use of any testing tools inbuilt in Visual Studio ;Please provide a hint or any links for the same.
Thanks in advance.
|
|
|
|
|
Hi,
You may take a look at the following links:
Link1[^]
Link2[^]
Link3[^]
Link4[^]
Hope this helps
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
after clicking Backup option form menubar how can i create backup of my whole project,can i get code for it i m using access as my backend.
|
|
|
|
|
how can i add .Net help to my project .can i get code for it.
|
|
|
|
|
Do you mean - how can I add help to my application, or how can I convert my code-comments into documentation? If it's help, then you will need the Html Help Workshop at the minimum, and possibly a good help authoring tool. If it's code commenting, you might want to look at using SandCastle.
|
|
|
|
|
Please describe your requirement in detail
Cheers!!
Brij
|
|
|
|