Posts Tagged code

Saturday, November 29, 2008 10:16

DataGridView Extension

DataGridView Extension

DataGridView Extension is a free component that extends the standard DataGridView control, provided with .NET 2.0 Framework.
Features

Customization the grid in IDE (design mode support for the background color and borders,default cell formatting, alignment,colors,column and row headers formatting, column sizing …).
Exporting the data within the data grid in several file formats (MS Excel,Html,PDF).
Build-in print [...]

Saturday, November 29, 2008 10:16

CAKE3 – Free archiving .Net library

Cake3 library supports compressing and extracting filesĀ  to/from different archive formats .The library can be easily integrated to your projects .
Usage of Cake3 library:
Compress

Cakdir3 cdir3 = new Cakdir3(@”c:\temp\arch.lha”);
cdir3.AddOptions.addFolder = AddOptions.folderMode.relative;
cdir3.AddOptions.baseFolder = @”c:\temp\”;
//Mask not supported in Cake3.
cdir3.AddOptions.addFile = new String[2] {@”c:\temp\arch.zip”, @”C:\temp\test\image.bmp”};
cdir3.Add();

Decompress

Cakdir3 cdir = new Cakdir3(@”c:\temp\test.lha”);
cdir.ExtractOptions.extractItem = new String[1] {cdir.Archive_Contents[0].fileName};
cdir.ExtractOptions.extractFolder = Utils.GetTempPath() + “qztemp”;
cdir.ExtractOptions.allowFolder = true;
cdir.ExtractOptions.allowOverwrite [...]

Saturday, November 29, 2008 10:16

Shaped Windows in WPF

Shaped Windows in WPF

In previous versions of Microsoft .Net Framework, creating shaped windows was a time-consuming process that involved Win API calls.Not anymore – one of the modern  aspects of WPF is that you can make  non-rectangular windows in simple way.Creating shaped forms works in the following manner.First, you create an image, which, when we are finished, will [...]

Saturday, November 29, 2008 10:16

CS2-C# Code Search

CS2 is capable of indexing source code files (at the moment only C# code can be parsed) and searching among them with various parameters, like class, property and method names, as well as full-text queries.
The main user interface for interacting with the search engine is an ASP.NET website built for version 2.0 of the .NET [...]

Saturday, November 29, 2008 10:16

Displaying large amount of data in DataGridView

DataGridView supports the special mode (Virtual Mode). The basic idea is that inside the control not stored any data. In given below example of the primitive electronic table, the data stored in the hashtable.The electronic table has a large amount of cells. In this example the number of cells equals to 100000 [...]

Saturday, November 29, 2008 10:16

Validating properties in a PropertyGrid control

The easiest way to validate a certain property is using the PropertyValueChanged event.The code bellow shows how to limit the valid range of Age property to be 1-150

using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
[...]

Saturday, November 29, 2008 10:16

Sorting System.Collections.Generic.List<T>

This post shows the sorting technique using anonymous delegate that can be implemented in any custom type generic list based on the selected property.For sorting any custom type the class must implement the System.IComparable interface. Now let me assume you have a Person class and if you want to sort the list of person objects [...]

Saturday, November 29, 2008 10:16

Return the value for the specific attribute using XPathNodeIterator

I will use the following XML document in the example below.

<?xml version="1.0" encoding="utf-8" ?>
<users>
<user FirstName="Tom" LastName="Adams" Age="23" />
<user FirstName="Jhon" LastName="Brams" Age="17" />
<user FirstName="Bill" LastName="Smith" Age="33" />
</users>

The code prints out all the user nodes of the users node that  have an age with a value greater than 17.

// Read the [...]

Saturday, November 29, 2008 10:16

C# String Library by Chad Finsterwald

Inspired by PHP String Functions that are missing in .Net.
Below is a list of the method names and descriptions in the string library.

Base64StringEncode: Base64 encodes a string.
Base64StringDecode: Decodes a Base64 string.
CaseInsenstiveReplace: A case insenstive replace function.
ReplaceFirst: Replaces the first occurence of a string with the replacement value. The Replace is case senstive. [...]

Saturday, November 29, 2008 10:16

Detecting Net Framework directory

You can use
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
or
HttpRuntime.ClrInstallDirectory property ( don’t forget to add reference to System.Web.dll )

Bookmark It

Hide Sites

$$(‘div.d766′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });