.net

What are the allowed .NET return types from a XSLT extension object method?

.NET allows to extend XSLT by using the so called extension object. Very handy and very convenient. You do so by creating a class: public class VeryHandyExtensionFunctions { public string VerySmartStringConcat(XPathNodeIterator NodeList) { return "some very smart string concat based on NodeList"; } } pending some ma...

Pocket PC/Windows Mobile: How to detect smart minimize

How do I detect when my Compact Framework application is being smart-minimized (smart minimize is what happens when the user clicks the "X" button in the top-right corner on a Pocket PC)? The Deactivate event isn't the right way because it occurs in circumstances other than minimization, such as when a message box or another form is sho...

Collections with events - is there a better choice than BindingList(of T)?

I needed a generic collection or list that can fire an event when an item is added or removed. I discovered that BindingList(of T) has events for this and wired up a quick proof of concept that worked fine. Of course, this doesn't feel like the most educated choice; BindingList is overkill for what I'm doing. Are there any simpler col...

Dynamic Context Menu on Treeview Nodes

Duplicate Of : http://stackoverflow.com/questions/2527/c-treeview-context-menus I've got a context menu on a Treeview, when the user right clicks it supposed to change based on the currently right clicked node's tag object. Currently I'm updating the context menu in after_select event, however this doesn't work when user right clicks t...

Is linq a cursor?

I'm familiar with .NET and with SQL. Now I'm looking at the new LINQ and it looks to me just like a cursor. I understand the ease of use, etc., but if I do a LINQ-to-SQL query with a foreach loop, am I just using a DB cursor? Or is there some sort of magic behind the scenes where LINQ collects all the data at once and feeds it to my p...

trying to convert rgb from a .net Color to a string such as "red" or "blue"

All of my methods are failing me in various ways. different lighting can mess it all up too. has anyone every trying to return a name given a rgb value? "red" "green" "blue" would be enough to satisfy my needs for today. i have unsafe byte processing of images from my web cam. ...

Add SubItems in TreeView

I'm sure this sounds like a n00b question, but how do I add sub items programmically while populating a TreeView list in VB.NET 3.5? I have the following code, but haven't been able to figure out how to add the sub items for each of the folders/files I'm populating the TreeView with: Private Sub AddToList(ByVal targetDirectory As Strin...

Are there any good parsing libraries for .Net?

I'm looking for something simple to use where the grammar is easy to define. ...

Creating a custom rule in FXCop

I want to create extra rules in FXCop. Custom Rules to help ensure specific best practices like checking against inline sql. I'm really looking for good resources and examples. Thanks! ...

Using tinyurl.com in a .Net application ... possible?

I found the following code to create a tinyurl.com url: http://tinyurl.com/api-create.php?url=http://myurl.com This will automatically create a tinyurl url. Is there a way to do this using code, specifically C# in ASP.NET? ...

How to update database table schemas with NHibernate schema generation?

I'm trying to figure out how to use NHibernate configuration with mapping to update table schemas, rather than dropping and recreating them. Currently I'm using the NHibernate.Tool.hbm2ddl.SchemaExport obj with FluentNHibernate to generate the database schema for a mysql database. While I can't say it's a huge problem, whenever I call ...

System Icons Retrieval in C# 1.0 and Alpha Channels

In a .NET 1.0 C# application, I wish to display a list of files and folders in a listview control. I want to programmatically retrieve from windows the icons for the files or folders to display them appropriately in the list view. At present, I am using the Windows API Shell32.dll, but am having problems with the alpha channel in the ic...

Wait for a remote process to finish in .net

We all know and love Process.WaitForExit(). Given a pid of a process on a remote machine (created by WMI/psexec), how do I wait for it to end? ...

Best practices for debugging

I've been doing quite a bit of debugging of managed applications lately using both Visual Studio and WinDbg, and as such I'm often ask to assist colleagues in debugging situations. On several occasions I have found people aho just insert break points here and there and hope for the best. In my experience that is rarely a useful technique...

Do you write interactive console applications?

I believe people still write a lot of console applications, including interactive ones, especially small utilities and administrative interfaces. Mostly for sake of simplicity. Do you write interactive console applications? Do you think it should be even easier than already is? U: for clarity, let's define 'interactive console applicat...

Is it possible to programmatically 'clean' emails?

Does anyone have any suggestions as to how I can clean the body of incoming emails? I want to strip out disclaimers, images and maybe any previous email text that may be also be present so that I am left with just the body text content. My guess is it isn't going to be possible in any reliable way, but has anyone tried it? Are there any ...

Finding the HTML element that a Silverlight control is hosted in

Is there a way to find the HTML element on the page that a Silverlight control is hosted in from within Silverlight? ...

SqlDataReader throws NullReferenceException! what could cause this and how can I debug?

I found this in an error log and am trying to work out how it's possible. It's not every day that a NullReferenceException turns up deep within the .net base classes! 1) Exception Information ********************************************* Exception Type: System.NullReferenceException Message: Object reference not set to an instance of an...

How to get all properties of an object and its sub objects

Hi, I have a similar question to this one except I need to loop all the sub objects and change the property to read-only Please check my code below. This one loop only the main object. When I tried to loop its sub objects, I got an overflow. Thanks. Public Class ReadOnlyTypeDescriptor Inherits CustomTypeDescriptor Priva...

Thoughts about using Silverlight In Desktop Apps?

To summarize, as we all know, a) Silverlight is expected to be hosted by a browser, and runs in an isolated sandbox so that there won’t be any security issues Silverlight don’t have direct access to the file system, other than the isolated storage area There is no direct way to open common dialog boxes like File Save in Silve...