C# Code Snippets

Shows how to focus a control in a Windows Form. If you are working with Web forms it is very simple, you just use "WebControl.Focus()" but this does not work for Windows Forms.

20 June, 2016   

How to find the next X day after a given Date time.

19 April, 2016   

A simple method that generates a MD5 hash from a given string. It should be compatible with PHP's md5() function (just lowercase the string).

05 August, 2015   

Shows how to access the HTTP headers from a given web adress.

23 July, 2015   

Use a session variable that you store and increase after each false login. Don't forget to clear the session after you close an account or after the login was successful.

20 July, 2015   

This example shows how to serialize a simple object by using the XmlSerializer.

15 March, 2015   

How to automize versioning by modifying a line in the AssemblyInfo file.

How to get returning value from a stored procedure

01 January, 2014   

Example shown here how to call a stored procedured in C#

14 January, 2012   

How to AccessText for TextBlock

14 January, 2012   

How to Setting AccessText properties

13 June, 2011   

This C# code snippet inputs the principal and interest amounts and calculates simple interest.

13 June, 2011   

This C# code snippet calculates a Fibonacci number using recursion, i.e., the Fibonacci method calls itself when necessary.