Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Everything / Languages / C#2.0

C#2.0

C#2.0

Great Reads

by Aydin Homay
In this article, I tried to show a real benchmark based on presser test method, for a Big Data collection deals on C++, C#, and VB.NET.
by Mike Corley
C# (.NET and Mono) library provider for RRDtool
by User 2739121
Using GDI+ and a transparent form
by Yvar Birx
Syntax highlighting has never been so easy!

Latest Articles

by Aydin Homay
In this article, I tried to show a real benchmark based on presser test method, for a Big Data collection deals on C++, C#, and VB.NET.
by Mike Corley
C# (.NET and Mono) library provider for RRDtool
by User 2739121
Using GDI+ and a transparent form
by Yvar Birx
Syntax highlighting has never been so easy!

All Articles

Sort by Score

C#2.0 

by Jeong, WonYoung(Brad)
Making BitField with C# alternative to BitField made with union and struct of C++
by Sambhav Yadav - Sam D Silva
ASP.NET page/master page/user control's life cycle from the perspective of Session and View State
by shijo joseph
A file backup manager with simple user interface and all the essential functionalities.
by Jarno Burger
A managed wrapper around FreeFrame, to give your video frames some cool effects
by shijo joseph
An easy to implement yet powerful logging library which requires absolute zero learning curve
by LLLLGGGG
A really simple implementation of a C# menu for console applications
by gunjan k saxena
This tip will help to create an action filter to compress the contents like Json, partial view, etc.
by DaveyM69
Now your application can update it's saved data regrdless of the account it is running under.
by reachme_saurabh
by Abhishek Sur
Thread.Sleep is actually used to block the thread Temporarily for an interval. Async CTP brings forth one probable alternative if you dont want to write yourself : TaskEx.Delay(milliseconds)Probably in next release it will be Task.Delay(milliseconds)This works little different as it...
by Mukund Thakker
Android GCM Push Notification
by Yossi Yaari
A basic yet generic state machine implementation
by nasir_ml
ASP.NET textbox validation made easy.
by DaveyM69
How to have a real console window as well as your forms
by johannesnestler
Very good tip. I just want to mention an alternative - you can just change your project output type to a console application. (You can undo it later if only needed for debugging). So if you started with a Windows Forms project in Visual Studio: Go to project properties/application/ and in the...
by fastal
VB version:Friend Declare Function AllocConsole Lib "kernel32.dll" () As BooleanFriend Declare Function FreeConsole Lib "kernel32.dll" () As BooleanSub main() Dim MainForm As New frmMain If Command = "" Then MsgBox1 = AddressOf MyMsgBox1 ' messagebox delegate sub call...
by Andreas Gieriet
To not having spoiled the client code with #if DEBUG, you might use the following:[STAThread]static void Main(){ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Debugging.DebugSetupConsole(); ...
by DaveyM69
A few quick examples of how to correctly create events.
by CoperNick
How suprising can be conversion of decimals to bytes in C#
by Emiliarge
Both MS Access formats (mdb and new - accdb), MSSQL 2008 R2, MSSQL CE, SQLite, MySQL
by Emiliarge
Read and write data to Access databases without limitations caused by the use of the SQL.
by Darkencrow
A multi-drawer style collapsable UI container
by Emiliarge
2 ways to read and write data to *.xls and *.xls files and display it on DataGridView.
by Qwertie
A fast and simple algorithm.
by Kaveh Yazdi Nezhad
A simple solution to capture entire HTML code of a web page which is displaying on Internet Explorer
by DaveyM69
How to prevent a CD/DVD drive from being opened.
by Steve Maier
To get this to work in .NET 4, you have to change the DLLImport signature.[DllImport("kernel32.dll", SetLastError = true)]private static extern IntPtr CreateFile( string lpFileName, uint dwDesiredAccess, int dwShareMode, ref SECURITY_ATTRIBUTES lpSecurityAttributes, ...
by Sitang Ruan
Central jQuery Version Control
by Ank_ush
How to change the background color for an MDI parent form in Visual C#This article demonstrates how to programmatically change the background color for a multiple-document interface (MDI) parent form by using Visual C#.When you use a Windows Form as an MDI parent form, the Application...
by DaveyM69
How to access a control from a different thread + good alternatives by other members!
by AspDotNetDev
This version works regardless of parameters:public void AnyMethod(int parameter){ MethodInvoker wrapper = new MethodInvoker(delegate() { // Do your thing here! }); if (this.InvokeRequired) this.Invoke(wrapper); else wrapper();}Note also...
by Moim Hossain
Doing like following for few years now :public void AnyMethod(int parameter){ var wrapper = new Action(()=> { // Do your thing here! }); if (this.InvokeRequired) this.Invoke(wrapper); else wrapper();}
by Surjit Singh Dadhwal
This post will help you to resolve problem of checking maxlength of Multiline textbox (Internet Explorer, Chrome & Firefox)
by Gandhi Ashish
Checking Internet Is Connected Or Not From .NET
by J a a n s
For C# guys....using System ;using System.Runtime ;using System.Runtime.InteropServices ;public class Internet{ [DllImport("wininet.dll")] private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ; public static bool...
by Anshul R
Dim value As Boolean = My.Computer.Network.IsAvailable can be used in a situation where the only network a system will be connected to is the Internet.Dim value As Boolean = My.Computer.Network.Ping(hostNameOrAddress ,timeout) hostNameOrAddress can be any valid website -...
by Abhishek Sur
It is to be noted, .NET has lately introducedResponse.RedirectParmanent() after a long await. The main motive of this is tohave permanent response redirection to the Search Engines.Response.RedirectParmanent() is an extension function introduced in .NET 4.0.Themain motive of it is to indicate
by Peter T. Ringering
A complete replacement to Microsoft's Date/Time Picker control.
by Sumon1524
Observu monitors your websites from multiple locations and combines it with measurements collected on your servers. Here this article will show how to send data to Observu.
by Anshul R
The Perfect Translation/Conversion of Code
by RaviRanjanKr
Convert Text to Image
by johannesnestler
I'd like to offer a "funny" alternative by using a dummy TextBox. public static Bitmap GetPlainTextBitmap(string strText, Font font, Color colorBack, Color colorText, Size sizeTargetBitmap) { // Create a dummy TextBox TextBox txDummy = new TextBox(); ...
by Shru37
Modified code from another article to consider field repetitions while converting HL7 message to XML
by Lee Louviere
Convert joystick movement into mouse position from a fixed center.
by Bryan Lyman
A method for duplicating a web page (including all scripts and styles) to run as if it originated from your own server, then modify server-side and client-side functionality afterwards.
by AshishChaudha
This tip talks about creating an auto complete textbox using jQuery.
by Rajkumar Reddy Mar31
Recently, one of my jobs demanded me to create a windows service for scheduling some tasks without human intervention, all we need to mention those services XML file.Configure the scheduled tasks in an XML file (Tasks.xml)On Service Start, load the tasks configuration from the Tasks.xml file...
by Mik Wadstrom
Simple way to use Crystal reports as embedded dynamic printable reports
by DaveyM69
Enables access to the original argument in all events
by Monotosh Roy Mon
XML Serialization & Deserialization for converting our object to XML and XML to Object
by nainakarri
Debugger showing wrong source file when debugging in VS2005
by Hassan Alrehamy
JSON Deserialization in depth concept and Dictionary mapping. Special Thanks to Dr. Coral Walker
by sourabhdev14
The GridView control in ASP.NET is used to represent information from a database in tabular format.
by Shailesh Pisat
Provides ready to use library for sending email using SMTP
by Jana Sattainathan
There is an easier way to get the Oracle data source than custom-code a TNSNames.ora parser.
by apis3445
With C# and the Windows API, you can execute a program in a second monitor.
by JRINC
Connect to remote socket via System.Net.Sockets.Socket.Connect method with timeout controlled by System.Threading.Timer
by Bhasker Kandpal
Exploring the behaviour and capabilities of a property grid control.
by AshishChaudha
This tip describes how to export data to an Excel file from a GridView.
by Rui Jorge Carvalho
Fast and simple Bitmap processor...
by sekharkaza
This code is very useful for those who want to know which aspcontrol has caused the postback.
by Yuri Heymann
Source code for the article titled "A Finite-Difference Model for the Thermal History of the Earth
by DaveyM69
How to convert a generic List of derived types to a generic list of base types.
by Kundan Singh Chouhan
Simple technique to handle text input and validations in single control
by DaveyM69
Starting a thread using a generic argument
by supercat9
Another approach is to use a generic delegate-factory class. Essentially, the class has a field of generic type, a delegate field which accepts an argument of that type, an parameterless instance method which accepts an argument of that type and invokes the delegate with it, and a static method...
by VallarasuS
Here is how you can achieve Gradients used in Office 2010 Buttons with a glow at the bottom.
by adolfobarallobre
Here is code for an alternate:public class OfficeButton : Button{ public OfficeButton() : base() { } private Color mGradientGlowColorColor; // the Color field public Color GradientGlowColor // the Color property { get { return...
by jp2code
Introduction...
by intrueder
My alternate uses the AddBezier method, and the size of the heart adjusts to the size of the form.private void Form1_Load(object sender, EventArgs e){ using(System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath()) { path.AddBezier(...
by atlaste
How to fix hiding controls in the Visual Studio user control designer
by the retired
High performance C# byte array to hex string to byte array.
by Abhay@Accenture
How to bind Derived Type in MVC View
by Anuraj Parameswaran
Delete a file or folder to Recyclebin using C#
by Péter V
How to detect 64 bit/process on .NET 2.0 to 3.5
by Brijesh Kr
How to disable Autorun C#
by KazMaxLtd
This article describes how to hide or show TabControl tabs at runtime
by Bernhard Hiller
That's far too obscure.All you need to do is store a reference to the TabPage instance which was removed from the TabPages collection of the TabControl. You may use the form where the TabControl is placed for that purpose.You could also create your own TabControl which has an extra property...
by Aydin Homay
In the tip, I want to illustrate how to host windows form in windows user control
by Sajid Asghar
How to insert Data in SQL server via SqlDataSource in ASP.NET
by Dinesh Kr. Choudhary
Code that measures a time interval as you would measure the execution time of a task
by Kees van Spelde
To encrypt or not to encrypt with C# .NET
by BenScharbach
How-To Convert a String Collection to a Multi-Enum item using TryParse
by Arno1973
A fix for ImageButtons problem in IE10 when project is not 4.5
by VaibhavTiparadi
Re-sizing images to equalize the width & height
by Alan N
Handling the Popup event raised by the System.Windows.Forms.ToolTip component would seem offer an ideal opportunity to alter the tooltip text to reflect an underlying change. Unfortunately the stack overflow caused by calling ToolTip.SetToolTip will soon put a stop to the attempt.The test...
by William Winner
First, why would you want to change the ToolTip text during the PopUp? Why not hook the MouseHover of the control that you want to change the ToolTip? Dynamically setting the ToolTip does not require hooking the PopUp event.How about: public partial class Form1 : Form { ...
by Hernán Hegykozi
Versioning file inclusion JavaScript by date of last modification
by Evgeny Pereguda
This is simple implementation of fast forward 1D DCT-II on MSIL which is generated at runtime.
by Andreas Gieriet
This is an alternative for "Sorting Strings based on the position of the block letter"
by Anand Gunasekaran
Listview Paging Feature to split the records of the listview in sevaral pages.
by Nick Yakov
How to can load a structure with unsafe coding and fill the structure using a byte array.
by Yossi Yaari
A solution for monitoring Events called during test.
by LShep
This tip describes an IEnumerable extension method that allows you to select an item modulo Count()
by Yuri Heymann
Source code for the paper titled "A Monte Carlo simulation framework for testing cosmological models"
by Pritam Deshmukh
This tip elaborates few useful tricks and shortcuts of VS 2013 mainly for professional edition (You can find them with Ultimate version too).
by BrokenEvent
Simple and fast .NET XML parser without using System.Xml
by Arman Aşçı
Parallel port data register control with C# .NET 2.0 and inpout32.dll.
by AshishChaudha
This tip describes the working of DetailsView for inserting a new record, updating and deleting the existing details of the user.
by textorijum
How to SIMPLY populate TreeView from some sort of "list" variable / object / structure
by Thomas Daniels
A tip about how to set the position of a Windows Forms MessageBox in C#
by ajaynarewade
This is helper class to post serialized objects (Data) to other page in asp.net.
by ednrg
This is a .NET port of a VBScript utility
by PIEBALDconsult
This is an alternative for "PrettyXML (.NET Port)"
by unikoon
I plead not guilty, editing this in an attempt to slightly improve it has put my name under it all. I did not write this, all I did was add some comment lines. Luc Pattyn, 28-DEC-2009.This simple code displays how to get machine IP address, Current user name and logged in domain name. Also...
by unikoon
This Tip will show how to read the Windows Event Log (Security Log) in your PC.You have to use these two libraries for collecting and access to Event Log.using System.Net;using System.Diagnostics;I wrote security Log reading code on button Click event. In below code, I read Windows...
by yousafzai amazai
ref and out parameters in C#
by linebenchmark
Remove all blank lines, containing or not spaces:^:b*$\n
by Ziv Nitzan
There is also a Visual Studio extention called CodeMaid that has a lot of cleaning options http://bit.ly/diMTaR
by Demid Korneev
Example of AltNETType use in OpenGL
by Rajdeep Debnath
Replace all HTML tags from text/string
by hari19113
This code will help us to reshape our Windows form.
by Philipp_Engelmann
This tip describes how to resize an existing image (e.g. uploaded by a user) so it does not exceed a defined size limit.
by Tyronne Thomas
Resolving a hostname in C#
by Yogesh Gulve
Return Comma Separated String using SQL
by PallavSingh
How to run a website on one PC to another PC through IIS 8.0
by Nelson Kosta Souto
Running the same compiled assembly on Windows and Linux.
by immortalus
This is an alternative for "Scroll Synchronization"
by Andrew Rissing
A function to generate an endless collection of scrolling text for your use/amusement.
by akramKamal
Code to serialize/deserialize any object to an XML file.
by Gautham Prabhu K
Creating and using Service Locator pattern
by Ed Gadziemski
How to set a null binary value (zero-length binary value) in the registry from your C# program.
by Prerak Patel
Here you'll fine many more..http://www.codinghorror.com/blog/files/Visual%20Studio%20.NET%202005%20Keyboard%20Shortcuts.htm[^]
by Behzad Talebpour
Alternatively, you can erase your closing bracket (}) and VS will format the whole block (between opening & closing bracket). This works only if there is no syntax error in that block.
by AshishChaudha
This article describes the working of fileupload inside an updatepanel and showing the file upload progress to the user.
by Pasan Eeriyagama
Simple Application Error Logging
by Sergey Morenko
Simple password generator, based on alphabets
by Shubham Choudhary
This software allows you show table (multiplication) of any digit.
by Atulkumar P Patel
Anti Patterns are wrong practice followed by Developers. They are opposite to Design Patterns.
by piyush_singh
Strings literals are sorted on the basis of the position of the first occurrence of a block letter inside it
by PIEBALDconsult
This is an alternative for "Sorting Strings based on the position of the block letter"
by Mohammed Hameed
Check-in/Check-Out mechanism for TFS - To avoid Build errors and improve productivity.
by Maxim Fedotov
Presents StringFormat methods with string (not integer) keys in 'format' string.
by dibley1973
Call stored procedures in a type safe way using my StoredProcedureFramework for .NET
by wmjordan
Generic Lists or Generic Types contravariance without casting.
by Pranay Rana
Following is code by which you get time in (HH:SS:MM) formate by passing second as argument public string getFormattedTimeFromSecond(double second) { TimeSpan t = TimeSpan.FromSeconds(second); string formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", ...
by Reddy Prakash
Hi All,We know that Oracle is no longer supporting Oracle 9i version. By this time all users have migrated to the latest versions. But still I want to give this tip/trick for those who are still using Oracle 9i as database.In this article I am gonna explain how to handle the Oracle error...
by Tauseef M
This tool is used for Encryption of Database in SQL Server 2008 Enterprise Edition
by Kiran Sonawane
A trick when using Array.Contains()
by Ctznkane
The Array class already contains this capability with no casting required. The IndexOf method is a static one that returns the index of the value and a -1 if it doesn't exist.Here is an example:exists = Array.IndexOf(arr, "item") >= 0
by LShep
Turn an Enum into a simple state machine via a generic wrapper and modular increment methods
by AnuragTripathi
Convertor for Unicode to Krutidev and vice-versa.
by Deepak Kr Choudhary
This article is about the session use in ASP.NET.
by wmjordan
Compile extension method targeting .NET 2.0 only
by Jacky Yiu
Visual cryptography is a cryptographic technique which allows visual information (pictures, text, etc.) to be encrypted in such a way that the decryption can be performed by the human visual system, without the aid of computers.
by In the Face of God
Generalize to access data in a database via HTTP
by Koshy Panicker John
Different Method(s) to Find IP Address?
by Mohammad A Rahman
namespace IpAddresses{ using System; using System.Collections.Generic; using System.Linq; using System.Net; class Program { static void Main(string[] args) { GetIPAddresses().ForEach(ip => Console.WriteLine(ip)); } ...
by Archimedes24
I find this useful:Dim st As System.IO.StreamDim sr As System.IO.StreamReaderDim req As System.Net.WebRequest = System.Net.WebRequest.Create("http://www.whatismyip.com/automation/n09230945.asp")Dim resp As System.Net.WebResponse = req.GetResponsest = resp.GetResponseStreamsr =...
by Anshul R
Private Sub GetIPAddress()Dim strHostName As StringDim strIPAddress As StringstrHostName = System.Net.Dns.GetHostName()strIPAddress = System.Net.Dns.Resolve(strHostName).AddressList(0).ToString()MessageBox.Show("Host Name: " & strHostName & "; IP Address: " &...
by nlarson11
On Vista/Win 7, I have seen code where only a single period is returned for (0). This makes sure you get the actual IP regardless of the system.Const IPPattern As String = "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"With Dns.GetHostEntry(System.Environment.MachineName) Return...
by Dinesh Kr. Choudhary
protected void Page_Load(object sender, EventArgs e){ HttpBrowserCapabilities bc = Request.Browser; Label1.Text = "IP Address=" + Request.UserHostAddress;}
by RayD111
Dim ipE As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName) Dim AL As Array = Dns.GetHostEntry(vWrkStn).AddressList Dim A As IPAddress For Each A In AL If A.AddressFamily = Sockets.AddressFamily.InterNetwork Then ...
by Emiliarge
Using WindowChrome from Microsoft.Windows.Shell.dll
by Md. Rashim Uddin
XML Serialization and Deserialization in c#
by Praveen Kumar Chauhan (PRK)
Sending Data Through XML to web Services