.net

.NET Framework versions

I've had a little search and I was wondering if there is back compatibility for the .NET framework. The real question is, if there's a program that uses .NET Framework 1.1, can I install 3.5 and be done, or do I have to install 1.1 and then if something uses 3.5 I have to install 3.5 as well? ...

How do I get the text size of a string on a WPF canvas?

I'm trying to find the amount of space/width that a string would take when its drawn on a WPF canvas? ...

Programmatic binding in Silverlight

I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help. When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml seem ok, but I'm doing somet...

Best Practices for embedding .NET assemblies in SQL Server

What are some important practices to follow when creating a .NET assembly that is going to be embedded to SQL Server 2005? I am brand new to this, and I've found that there are significant method attributes like: [SqlFunction(FillRowMethodName = "FillRow", TableDefinition = "letter nchar(1)")] I'm also looking for common pitfalls to a...

.NET ActiveX Component in IE - How to Get Browser Reference

I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this: using System; using System.Runtime.InteropServices; using BrowseUI; using mshtml; using SHDocVw; using Microsoft.Win32; namespace CTI { public interface CTIActiveXInterface { ...

MSBuild ItemGroup, excluding .svn directories and files within

How can I construct a MSBuild ItemGroup to exclude .svn directories and all files within (recursively). I've got: <ItemGroup> <LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude=".svn" /> </ItemGroup> At the moment, but this does not exclude anything! ...

How do I change the type of control that is used in a .NET PropertyGrid

I have a Windows application that uses a .NET PropertyGrid control. Is it possible to change the type of control that is used for the value field of a property? I would like to be able to use a RichTextBox to allow better formatting of the input value. Can this be done without creating a custom editor class? ...

How do I invoke an exe that is an embedded resource in a .Net assembly?

I have a non-.Net executable file that is included in my .net assembly as an embedded resource. Is there a way to run this executable that does not involve writing it out to disk and launching it? This is .Net 2.0. ...

"Could not find file" when using isolated storage

I'm saving some stuff in an IsolatedStorageFile. It works well and I can retrieve the saved values when calling the saving and retrieving methods in my DAL layer from my GUI layer. However, when I try to retrieve the same settings from another assembly in the same project, it gives me a FileNotFoundException. What do I do wrong? This is ...

Trigger update on DataTable bound to DataGridView

In my .NET/Forms app I have a DataGridView which is bound to a DataTable. The user selects a row of the DataGridView by double-clicking and does some interaction with the app. After that the content of the row is updated programmatically. When the user selects a new row the changes on the previous one are automagically propagated to the...

Can I supress FX Cop code analysis violations globaly?

When you use Visual Studio's code analysic (FxCop), and want to supress a message there are 3 options. Supress a violation in code. Supress a violation in a GlobalSupression.cs file. Disable the violation check in the project file (via Project -> Properties -> Code Analysic). The later is very hard to review when checking in to Sourc...

.NET Windows Forms Transparent Control

I want to simulate a 'Web 2.0' Lightbox style UI technique in a Windows Forms application. That is, to draw attention to some foreground control by 'dimming' all other content in the client area of a window. The obvious solution is to create a control that is simply a partially transparent rectangle that can be docked to the client are...

What's the best way to handle long running process in an ASP.Net application?

In my web application there is a process that queries data from all over the web, filters it, and saves it to the database. As you can imagine this process takes some time. My current solution is to increase the page timeout and give an AJAX progress bar to the user while it loads. This is a problem for two reasons - 1) it still takes to...

FileSystemWatcher Dispose call hangs

We just started running in to an odd problem with a FileSystemWatcher where the call to Dispose() appears to be hanging. This is code that has been working without any problems for a while but we just upgraded to .NET3.5 SP1 so I'm trying to find out if anyone else has seen this behavior. Here is the code that creates the FileSystemWatch...

When using Linq to SQL with stored procedures, must char(1) columns be returned as c# chars?

When using Linq to SQL and stored procedures, the class generated to describe the proc's result set uses char properties to represent char(1) columns in the SQL proc. I'd rather these be strings - is there any easy way to make this happen? ...

What is the difference between lambdas and delegates in the .NET Framework?

I get asked this question a lot and I thought I'd solicit some input on how to best describe the difference. ...

.NET Introspection VS Reflection

What is the difference between Introspection and Reflection in .NET ...

How to gracefully deal with ViewState errors?

I'm running some c# .net pages with various gridviews. If I ever leave any of them alone in a web browser for an extended period of time (usually overnight), I get the following error when I click any element on the page. I'm not really sure where to start dealing with the problem. I don't mind resetting the page if it's viewstate has e...

How can I highlight the current cell in a DataGridView when SelectionMode=FullRowSelect

I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row is highlighted when the user clicks on any cell). However I would like the cell that currently has focus to be highlighted with a different back color (so the user can clearly see what cell they are about to edit). How can I do this (I do not want t...

FTP client class for .NET

Anyone know of a good, hopefully free FTP class for use in .NET that can actually work behind an HTTP proxy or FTP gateway? The FtpWebRequest stuff in .NET is horrible at best, and I really don't want to roll my own here. ...