.net

How to Disable Alt + F4 closing form?

What is the best way to disable Alt + F4 in a c# win form to prevent the user from closing the form? I am using a form as a popup dialog to display a progress bar and I do not want the user to be able to close it. Thanks. ...

Web Application Testing for .Net (WatiN Test Recorder)

I've been using WatiN as a testing tool for my current project. Besides the minor bugs with the Test Recorder, I've been able to use it and automate a lot of my tests in conjunction with NUnit. Anyone else out there with experience with different tools they might suggest? ...

Looking for example of Command pattern for UI

I'm working on a WinForm .Net application with the basic UI that includes toolbar buttons, menu items and keystrokes that all initiate the same underlying code. Right now the event handlers for each of these call a common method to perform the function. From what I've read this type of action could be handled by the Command design patte...

find orphaned methods in codebase

I'm sure we've all seen it before...A code base that has been around for a year or two, and as features have been added and bugs fixed, we end up with pieces of code that aren't actually in use anymore. I'm wondering if there is a way (especially in VS.NET with or without a third-party tool) to search the codebase and show me which meth...

Cycle Button Background Images in C#

I have a form in C# that has a button that, when clicked, I want the background image to cycle through a set of images (which I have as resources to the project). The images are named '1', '2', etc. and each time I click the button I want its background image to increment to the next one and go back to "_1" when it gets to the highest. ...

Do you have any recommended code-snippets for Microsoft Visual Studio?

What are some macros that you have found useful in Visual Studio for code manipulation and automation? Since good code can be useful in all languages, this question is not language specific. ...

.net Job Interview

I have a job interview tomorrow for a .net shop. For the past few years I have been developing in languages other than .net and figure it is probably a good idea to brush up on what is cool and new in the world of .net. I've been reading about LINQ and WPF but these are more technologies than trends. What else should I look at? Been ...

What is the best way to iterate through a strongly-typed generic List<T>?

What is the best way to iterate through a strongly-typed generic List in C#.NET and VB.NET? ...

Setting an ASP.NET Master Page at runtime

I'm working on a site which needs to be able to support two or more looks, changable at runtime. I'd hoped to be able to handle the change with a CSS switch, but it looks like I'll need to use a different masterpage for each design. So, what's the best way to set the masterpage at runtime? Page.MasterPageFile can only be set in the Page...

Does anyone have any real-world experience of CSLA?

The main web application of my company is crying out for a nifty set of libraries to make it in some way maintainable and scalable and one of my colleagues has suggested CSLA. So I've bought the book but as : programmers don't read books anymore I wanted to gauge the SOFlow community's opinion of it. So here are my questions. Ho...

Practical use of System.WeakReference

I understand what System.WeakReference does, but what I can't seem to grasp is a practical example of what it might be useful for. The class itself seems to me to be, well, a hack. It seems to me that there are other, better means of solving a problem where a WeakReference is used in examples I've seen. What's the canonical example of ...

Is the .NET Client Profile worth targetting?

I've recently been looking into targeting the .NET Client Profile for a WPF application I am building. However, I was frustrated to notice that the Client Profile is only valid for the following OS configurations: Windows XP SP2+ Windows Server 2003 Edit: Appears the Client Profile will not install on Windows Server 2003. In additio...

Runtime Configuration in .Net (specifically the EntLib)

Hi All, I'm looking for a way to configure a DB connection at runtime; specifically using the Enterprise Library. I see that there's a *.Data.Configuration (or something close to this ... don't recall off the top of my head) assembly but am finding not much on the interwebs. Complicating matters is the fact that the API help is broken...

Reading Excel files from C#

Is there a free or open source library to read Excel files (.xls) directly from a C# program? It does not need to be too fancy, just to select a worksheet and read the data as strings. So far, I've been using Export to Unicode text function of Excel, and parsing the resulting (tab-delimited) file, but I'd like to eliminate the manual s...

How to apply multiple styles in WPF

In WPF, how would I apply multiple styles to a FrameworkElement? For instance, I have a control which already has a style. I also have a separate style which I would like to add to it without blowing away the first one. The styles have different TargetTypes, so I can't just extend one with the other. ...

Best Way To Determine If .NET 3.5 Is Installed

I need to programatically determine whether .NET 3.5 is installed. I thought it would be easy: <% Response.Write(Environment.Version.ToString()); %> Which returns "2.0.50727.1434" so no such luck... In my research I have that there are some rather obscure registry keys I can look at but I'm not sure if that is the route to go. Does a...

Calling .NET Web Service (WSE 2/3, WS-Security) from Java

I need to call a web service written in .NET from Java. The web service implements the WS-Security stack (either WSE 2 or WSE 3, it's not clear from the information I have). The information that I received from the service provider included WSDL, a policyCache.config file, some sample C# code, and a sample application that can succes...

Removing N items from a list conditionally

I was writing some ASP.NET control when I came to the scenario where I needed to remove items from a list, only when they matched a certain condition. The RemoveAll method of the generic List class does a good job, but removes all items that match the condition, specified by the predicate. What if I want to only remove a certain number ...

best .net build tool

What is the best build tool for .net. I currently use nant but only because I have experience with ant. Do people prefer msbuild ? ...

VS.NET Application Diagrams

Have you used VS.NET Architect Edition's Application and System diagrams to start designing a solution? If so, did you find it useful? Did the "automatic implementation" feature worked ok? ...