|
Duncan Edwards Jones wrote: even if that application code doesn't have any reference at all to the class
Then it won't get loaded.
Try adding a field to the class that contains the Main.
|
|
|
|
|
It will get loaded if the application .config references the class - this is how Trace Listeners get added / removed without recompiling.
|
|
|
|
|
I don't use those and I don't know what they're good for.
But now I'm wondering what the heartbeat the OP is talking about does.
I'll have to go reread the post.
|
|
|
|
|
A) I expect the class doesn't need to be instantiated until a listener is attached.
B) Is it using events? If not, why not?
C) What's it supposed to do? It seems like all it does is let the listeners know that the class is in memory, not that it's actually doing anything. I prefer my Windows Service code's "heartbeats" to be generated within the service loop itself, so I know the actual code is progressing.
There are times when a Service gets "hung up", at those times I don't want some other thread telling me that everything is going just fine.
Also, the "heartbeats" I use are merely updates to a database, so any system on the network can check the status of all my Services on all the servers. Plus the advantage that a successful "heartbeat" means that the Service can write to the database, which is an important test.
I expect all you really need is an event that you raise at different points in your code.
|
|
|
|
|
In my property grid I have a couple of properties that have an expand ("+") indicators next to them. When I click on them the indicators disappear. These properties don't have any sub-properties to display so I'm not sure why the expand indicator is even drawn. If I change a property in the propertygrid and it is re-drawn the indicators come back.
Any ideas? Functionally it isn't a problem, it's just ugly.
|
|
|
|
|
For that particular property, is its return value an object that has properties of its own? The problem may be occuring because the property has subproperties but the IDE does not know how to design them. This would mean the '+' would go away.
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 homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Yes they are objects that have properties of their own, with BrowsableAttribute set to false. Do you see a workaround for this?
Edit: I stand corrected. I just built a small test case with the return property having NO sub-properties and the phantom expand mark still showed up.
modified on Thursday, July 31, 2008 12:49 PM
|
|
|
|
|
I can't think of anything off of the top of my head that would prevent that attribute from working . The only thing that might be able to help is an article I wrote on design-time events[^], but even then it doesn't have the specifics of what you are looking for.
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 homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
I figured it out.
I was being a dummy.
My type converter class(es) where of base type ExpandableObjectConverter when they should have been TypeConverter.
|
|
|
|
|
Peer pressure from this group has forced me to implement IDisposable on my class.
My reading of the Dispose() documentation tells me that I should:
1. call Dispose() from my destructor
2. keep a private field (this.disposed ), and set it at the end of my Dispose() method
3. "test this.disposed in all of your class' regular methods, and throw an exception if the object is already disposed." (emphasis mine)
Does this mean I also need to test this.disposed in the get/set clauses of my properties?
Or just in my "regular methods"?
|
|
|
|
|
It's kind of an extra check. The world isn't going to end if you don't do the check, but it might add an extra bit of insurance that things aren't going wrong.
You should never access a disposed object, it can cause all kinds of problems. The check is only there to ensure that you don't. Personally, I do the check in _public_ methods, but tend not to bother in properties. Although technically you probably should.
I'd be interested in other people's opinions on this though.
Simon
|
|
|
|
|
And then what do you do if the instance has been Disposed?
"
The primary use of this interface is to release unmanaged resources.
"
When a class doesn't directly use unmanaged resources or a resource that implements IDisposable, then I generally don't implement IDisposable on it. However, implementing IDisposble allows for the class' use in a using statement which is a very handy technique, so in some cases I may implement a Dispose method that does nothing or otherwise leaves the instance in a usable state.
So I don't bother with tracking whether or not Dispose has been called on the instance.
If Dispose has released some resource, then generally the instance's reference will be null and I can check that and either make a new instance or throw an Exception, as appropriate.
|
|
|
|
|
JoeRip wrote: call Dispose() from my destructor
Please make sure you are getting the terminology correct. In C#, the "destructor" is the Dispose() method. If you mean you are calling Dispose() from a method like ~Class() , then you are calling it from a finalizer. If that's the case, you need to triple-check the decision to use a finalizer and make sure that you have everything written correctly as they add a performance penalty to your object and are not trivial to write properly.
JoeRip wrote: Does this mean I also need to test this.disposed in the get/set clauses of my properties?
A lot of this really depends on why you are implementing IDisposable . If you are maintaining some unmanaged resources or other objects that implement IDisposable then you would want to do this test in your public methods and properties. You can simplify this by creating a single helper method that throws an ObjectDisposedException and then just call that as the first line in any of your methods or properties.
If you are using IDisposable simply to get the "using semantics", then you don't need to bother.
You can check this article[^] for more information on how to write finalizers and the dispose pattern as well.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Any one have the Cadlib source code in c# .
Please maile me:muralikumarm76@yahoo.com.
Thank you
..murali
|
|
|
|
|
|
hi simon,
I didn't find it.do u have any sample code using c#
|
|
|
|
|
Seeing as I'm feeling generous, I'll make it easier for you. It's the first one in the results (here[^])
It's not written in C# so there is no C# source code.
If you want to use it from C# you need to learn about Com-Interop. maybe start here[^]. There's also a blog post about it here[^].
Try it. If you get stuck, post what you've done, and what goes wrong, and I'll help you.
Simon
|
|
|
|
|
So I'm building several reports within my application and I wanted to have the functionality that the visual studio report builder gives me. I'm currently using Report Builder v8.0 because I have to construct for the 2.0 framework.
Anyway, here is my problem: I want to do alternating row colors within my table. In the backcolor property I have the function
=iif(RowNumber("DataSet_GetPersonData") Mod 2, "BurlyWood", "White")
If I put this in the backcolor property of the table, the rows inherit only the second color, "white." If I put this in the backcolor property of the row instead, I get the desired look (first row brown, second row white, etc) except the first column doesn't inherit either of the colors. Instead it remains transparent. I've modified the scope several times, using "nothing" and "table 1" instead of "DataSet_GetPersonData" getting the same results each time. What the heck am I doing wrong??
"The shortest distance between two points is under construction"
-Noelie ALtito
|
|
|
|
|
UPDATE:
Turns out when you are developing web applications you should test your product on browsers that don't begin with Mozilla and end in Firefox. Works fine in I.E. I lose.
"The shortest distance between two points is under construction"
-Noelie ALtito
|
|
|
|
|
Hi! I want to write a class for login for the project. I want to know how do i read the username and password from the database. I have a window with two textboxes(username, password) and a submit button.
Thank you
|
|
|
|
|
This page[^] contains the exact information you need...
|
|
|
|
|
You want to Check if the Username and Password Exists in your table, So you can Write a SProc to count the records in the DB and in your class you can have a function that will tell you if the records exists , if it does not , you can return a message to your user that says "invalid Login". Remember dont display to much info, because you might get injected.
Hope this Helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi there! How can we get the mimetype of a file without using is extension?
I have a lot of .dat file on a server and I wanna know what is the mimetype of each of them. But all I found is fonction/properties related to the extension of the file! It's a no brainer to know that a .xls is an Excel type file
Anyone has a clue?
Thanks.
|
|
|
|
|
No, there's no way to get the mime type without the extension unless you want to try opening the file and try to read it as if it's a file of the desired mime type.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Additionally to what John said, you need to open the file and check the file header (if existent) against a list of known file headers.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|