@bobnoordam

Category: C#

Performance counter browser

A simple windows tool to browse performance counters on your local system In the first column, the list of categories is shown Upon selection, the second column will show the list of instance After which the third column will show the actual list of performance counters If you select an actual counter, the bottom right will show you a sample from the counter with a 1 second interval. Source and releases can be downloaded from github

Using backgroundworkers with progress reporting and cancelation

With the release of VS11 around the corner and the new async features in there everyone will have a wide toolset for writing non blocking responsive applications. If you have not yet played with the beta versions or regular threads (see for example Threads and the threadpool then the backgroundworker is the most basic component […]

Coloring individual cells or rows in a DX Gridcontrol based on a cell value

Coloring individual cells This sample hooks into the RowCellStyle event of the Gridview, and evaluates the value of the cell. Depending on the outcome, a background color is assigned to the cell. private void gridViewQueue_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) { var oView = (GridView)sender; if (e.Column.FieldName == “task_stamp”) { Color oBgcolor; var dtValue = DateTime.Parse(oView.GetRowCellValue(e.RowHandle, “task_stamp”).ToString()); […]

Importing data from an Excel sheet

C# Example using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.Linq; using System.Text; namespace Excel2Table { public class ExcelReader { /// <summary> /// Reads an excel file with OLEDB, and returns a datatable object from the content. The sheet to be imported /// needs to be named “Import” in the excel file. /// </summary> […]

Threads and the Threadpool

This small demonstration code snippet will show you how to: Create threads to run code in the background of your application Demonstrate how to pass one or more parameters to a background thread Demonstrate how to wait for all background activity to finish before exiting the main program. using System; using System.Collections.Generic; using System.Threading; using […]

Using LINQ with MySQL

This code demonstrates access to OSCOMMERCE database objects which are hosted on a mysql server, through the enitity framework and LINQ. Additionaly, the connectionstring is overriden at runtime to seperate developent and production environments. Install the MySql connector for visual studio Add a ADO.NET Entity data object to the solution Use the Wizard to create […]

Resursively listing a directory tree using a stack object

The class offered below shows an implementation of an efficient way to scan large filesystem trees and returning the content. By not using recursion but controlling the worklist with a stack element a large part of the load on the GC is reduced. Using recursion the collection of created objects by the recusrive calls can’t […]

Next Page »