.net

Mapping computed properties in Linq-to-SQL to actuall SQL statements

I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to use this property in a lambda expression or in general in a query it either throws an exception that ther...

The Best Free .Net DataGrid?

Which and why is the best free for commercial use Windows Forms .Net Datagrid? ...

Initialized event of WPF UserControl not firing.

Hello, I've got a very simple WPF UserControl that looks like this: namespace MyUserControl { /// <summary> /// Interaction logic for UserControl1.xaml /// </summary> public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } protected override void OnRender(Drawi...

C# controls in a MFC Application

I am responsible for the User Interface of an application written completely in Visual C++ using MFC and some third-part controls. I would like to use C# (WinForms or even better WPF) to improve the application look&feel. I would like some advices about how to do it. Links, articles, examples... Right now the user interface is isolate...

How to change the backcolor of a row in a DataGridView based on the value of a cell?

Say I have a DataGridView which shows the content of a DataTable. I want to be able to set the backcolor of a row based on the value of a cell in this row. Note that the cell in question is in a column which is not displayed in the DataGridView (Visible=False). ...

How is 'from/where/select' keywords impemented under the hood (c#,LINQ)

When I type 'from' (in Linq query) after improrting system.Linq namespace it is understood as a keyword; how does this magic hapen. is 'from' a extension method on some type? ...

T4 Template directory missing on build server

I've just set up a new build server with the Windows 2008 .NET 3.5 SDK, and for some reason it hasn't installed c:\Program Files\Common Files\Microsoft Shared\TextTemplating so I can't run t4 templates on it. I had a look at the install options in add/remove programs and every single option is checked. Any ideas why it is missing? Any ...

What are the basic minimum set of Code Analysis rules that you would recommend?

What are the basic minimum set of Code Analysis rules that you would recommend for a 200K LOC solution? We're using unit testing but code analysis has been turned off. Ideally all rules would be turned on by default but I'd like to do this gently and turn on rules in batches so we do not have to deal with everything at once. So, what r...

Built in code generation in vs.net 2008? or free via MS?

Hi, What code generation tools are built-in to vs.net 2008 or are officially available via Microsoft? I know of: Entity Framework sqlmetal What else is there? Ideally i'm looking for something that will generate from an existing database schema. ...

Entity Framework Validation

I'm getting ready to start a new project and I've been researching the entity framework. My question is what is the best strategy for validating the entities? Other projects I've worked on have used attributes for most of the validation, but obviosuly this is not possible in the entity framework. Is the only way to do this by handling th...

What is the best way to store static unit test variables?

I am currently using NUnit and testing a class library. Up until now, I have used a list of constants at the top of the test class to hold some static test variables. Is this the best way to do this, or is there a more fluent way to handle it? ...

When would you use delegates in C#?

What are your usage of delegates in C#? ...

How can I find the user's fonts in my .NET application?

How can I find the font that the user has set in their Windows Display Properties using C# in .NET? I want to display a form using the fonts that the user has selected. The fonts I want are those selected in the Windows Display Properties form for 3D-objects, menus and window title bars. But I cannot find a way to access them. There is...

Recommend an Open Source .NET Barcode Reader Library

Based on the stackoverflow question titled "Barcode- and Character Recognition component for .Net" we've discovered open source libraries for character recognition, but nothing's turned up for barcode recognition. Does anyone know of an open source .NET barcode reader library? EDIT: I'm asking for a library that can translate barcodes ...

How to set selected row of DataGridView to newly-added row when the grid is bound to sorted DataView?

I have a DataGridView bound to a DataView. The grid can be sorted by the user on any column. I add a row to the grid by calling NewRow on the DataView's underlying DataTable, then adding it to the DataTable's Rows collection. How can I select the newly-added row in the grid? I tried doing it by creating a BindingManagerBase object boun...

How can I set and restore FPU CTRL registers?

I can reset FPU's CTRL registers with this: http://support.microsoft.com/kb/326219 But how can I save current registers, and restore them later? It's from .net code.. What I'm doing, is from Delphi calling an .net dll as an COM module. Checking the CTRL registers in delphi yield one value, checking with controlfp in the .net code giv...

How would you reference lookup/meta data?

I've run into this issue quite a few times and never liked the solution chosen. Let's say you have a list of States (just as a simple example) in the database. In your code-behind, you want to be able to reference a State by ID and have the list of them available via Intellisense. For example: States.Arizona.Id //returns a GUID ...

Maintiaining SQL Transactions over web service calls in .Net

How do I perform a database transaction where I create a new record then make a call to a web service using the new record ID returned from the database which will also manipulate the same database? I could obviously update all tables directly from the same SQLConnection object but the logic within the web service call is subject to chan...

VS2005 C# Currency Manager Issue with Position Not Changing

We have a custom collection of objects that we bind to a listbox control. When an item is added to the list the item appears in the listbox, however when one selects the item the currency manager position will not go to the position. Instead the currency manager position stays at the existing position. The listbox item is high lighted as...

DataTable + DataGrid Data Binding Performance Againsts Custom Data Source Object + Data Grid

In our industrial automation application, we need to capture and display the data in the milliseconds. We have data binding between data grid control and a DataTable object. We have around three hundred records which needs to be display in the grid. So we update the 300 records every time we get the records. Example TabularVi...