.net

Experience with SQLExpress for a multi-user commercial application?

I have inherited a VB6/Access application that we have developed and sold for many years. We're going to SQL Server 2005 Express Edition and .Net. The application can be multi-user. Currently the setup is simple for the customer -- Navigate to the folder to create the database on first launch; second user browses to the same file. ...

Can I get calling instance from within method via reflection/diagnostics?

Is there any way via System.Reflection, System.Diagnostics or other to get a reference to the actual instance that is calling a static method without passing it in to the method itself. For example, something along these lines class A { public void DoSomething() { StaticClass.ExecuteMethod(); } } class B { public...

Barcode- and Character Recognition component for .Net

I need to extract and decode barcodes and text from images. Is there any open source library available that helps to accomplish that task? If not, do you know a good commercial product? ...

How do I capture an asterisk on the form's KeyUp event? OR, How do I get a KeyChar on the KeyUp event?

I'm trying to hijack an asterisk with the form's KeyUp event. I can get the SHIFT key and the D8 key on the KeyUp event, but I can't get the * out of it. I can find it easily in the KeyPress event (e.KeyChar = "*"c), but company standards say that we have to use the KeyUp event for all such occasions. Thanks! ...

Keyboard shortcut to close all tabs but current one in Visual Studio?

Does anyone know a keyboard shortcut to close all tabs except for the current one in Visual Studio? And while we're at it, the shortcut for closing all tabs? Is there a Resharper option for this? I've looked in the past and have never been able to find it. ...

How do I find out what directory my console app is running in with C#?

How do I find out what directory my console app is running in with C#? ...

Yield In VB.NET

C# has the keyword called yield. VB.NET lacks this keyword. I am curious how some of the VB programmers have gotten around the lack of this keyword. Do you implement your own iterator class? Or do you try and code to avoid the need of an iterator? The yield keyword does force the compiler to do some coding behind the scenes. http://...

How to get the underlying value of an enum

I have the following enum declared: public enum TransactionTypeCode { Shipment = 'S', Receipt = 'R' } How do I get the value 'S' from a TransactionTypeCode.Shipment or 'R' from TransactionTypeCode.Receipt ? Simply doing TransactionTypeCode.ToString() gives a string of the Enum name "Shipment" or "Receipt" so it doesn't cut the musta...

Good example of use of AppDomain

I keep getting asked about AppDomains in interviews, and I know the basics: they are an isolation level within an application (making them different from applications) they can have threads (making htem different from threads) exceptions in one appdomain do not affect another appdomains cannot access each other's memory each appdomain...

Automatically select all text on focus in WinForms TextBox

When a C# WinForms text box receives focus, I want to select all the text in the textbox. To see what I mean, click in your web browser's address bar. See how all text was selected? I want to do that. FASTEST GUN ALERT: please read the following before answering! Thanks guys. :-) Calling .SelectAll() during the .Enter or .GotFocu...

Crystal Reports and LINQ

Has anyone figured out how to use Crystal Reports with Linq to SQL? ...

Binding a null value to a property of a web user control

Working on a somewhat complex page for configuring customers at work. The setup is that there's a main page, which contains various "panels" for various groups of settings. In one case, there's an email address field on the main table and an "export" configuration that controls how emails are sent out. I created amain panel that se...

NHibernate, auditing and computed column values

How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties? E.g. every table contains audit columns like CreatedBy, CreatedDate, UpdatedBy, UpdatedDate. But I dont want to add these poperties to the domain classes. I want to keep domain modedl Per...

What's the best tool to track a process's memory usage over a long period of time in Windows?

What is the best available tool to monitor the memory usage of my C#/.Net windows service over a long period of time. As far as I know, tools like perfmon can monitor the memory usage over a short period of time, but not graphically over a long period of time. I need trend data over days, not seconds. To be clear, I want to monitor th...

Is there a control for a .Net WinForm app that will display HTML

I have a .net (3.5) WinForms application and want to display some html on one of the forms. Is there a control that I can use for this? ...

What to use for version control with Visual Studio 2008 for inhouse projects?

We want to put a number of our in-house projects under version control. Our projects are C# .NET applications and assemblies. We originally decided to go Microsoft all the way (as is the norm around here), and tried installing Visual Studio Team Foundation Server. To say the least, it was way more trouble of trying to get a successful in...

Algorithm for hit test in non-overlapping rectangles

I have a collection of non-overlapping rectangles that cover an enclosing rectangle. What is the best way to find the containing rectangle for a mouse click? The obvious answer is to have an array of rectangles and to search them in sequence, making the search O(n). Is there some way to order them by position so that the algorithm is le...

WAS hosting vs. Windows Service hosting

I'm working on a project using Windows 2008, .NET 3.5 and WCF for some internal services and the question of how to host the services has arisen. Since we're using Windows 2008 I was thinking it'd be good to take advantage of Windows Process Activation Service (WAS) although the feeling on the project seems to be that using Windows Ser...

Wrap a delegate in an IEqualityComparer

Several Linq.Enumerable functions take an IEqualityComparer<T>. Is there a convenient wrapper class that adapts a delegate(T,T)=>bool to implement IEqualityComparer<T>? It's easy enough to write one (if your ignore problems with defining a correct hashcode), but I'd like to know if there is an out-of-the-box solution. Specifically, I wa...

What is the best logging solution for a C# .NET 3.5 project

Hi, My team is about to start a new enterprise wide ASP.NET development project, quite possibly the largest undertaken by my department so far and the largest project that I've ever worked on. I'm looking for a good logging solution for the system. There are two questions I have if anyone knows the answer. Firstly what logging tool...