C# - Miscellaneous
Calculate Age
Date : 13 Jul 2010
Views : 166
This code snippet shows how to calculate an age from a date of birth.
Get Timezones
Date : 01 Jun 2010
Views : 60
This code snippet gets a list of timezones on the machine.
Get List Of Countries
Date : 19 May 2010
Views : 147
This code snippet can be used to get a list of all countries
Load MS Word
Date : 16 Apr 2010
Views : 224
This code snippet shows how to load an MS word document.
List Services
Date : 12 Jan 2010
Views : 222
This code snippet will list all the services on the machine and show the service status.
Get System Information
Date : 06 Jan 2010
Views : 382
This code snippet gets basic system information, such as computer name and username.
Get Icon Count From ExtractIconEx WinAPI
Date : 04 Jan 2010
Views : 542
This code snippet demonstrates how to get the total number of Icons in a DLL file.
Using Params With Multiple Data Types
Date : 04 Jan 2010
Views : 299
This listing contains a method named Print of the class Garbage in Lines . The Print method is declared to take a variable number of objects. Any data type can be fitted into an object, so this enables the method to take any data type. The code within the method should be easy to follow. If you look at the output, you will see that in Line 30, the first call to the Garbage.Print method prints a single value, 1. The second call in Line 32 did not pass any arguments. The Garbage.Print method is still called; however, the logic in the method doesn’t print anything. The for statement ends when it checks the args.Length value the first time. The third and fourth calls to Garbage print various other values. By using a type of object, any data types can be passed in either as variables or as literals.
Get Cursor Position
Date : 03 Jan 2010
Views : 1039
This code snippet allows you to get the X and Y coordinates of the mouse cursor.
Check If Current Thread Is Alive
Date : 01 Jan 2010
Views : 1132
This snippet checks if the current thread is alive. New Snippets
Highlight Input Element On Focus
Javascript
JQuery
This code snippet shows how to highlight an input element when it has focus and remove the highlight when it loses focus.
Calculate Age
C#
Miscellaneous
This code snippet shows how to calculate an age from a date of birth.
Sliding Tab Control
Javascript
JQuery
This code snippet shows how to develop a simple tab control, that slides tab pages when you click onto a tab.
LINQ Example 1
C#
LINQ
This code snippet uses where to find all elements of an array that is less than 10.
Simple MySQL Class To Query Database
Java
Database
The following code snippet shows how to create a simple MySql class that can be used to create a connection to the database server and execute queries which return a ResultSet object.
Connect To MySQL Database
Java
Database
This code snippet shows how to connect to a MySQL database server. You will need to download Connector/j.
File Viewer Example
Java
Controls
This code snippet shows how to open a file for reading and display the data into a JTextArea component.
JMenu With ActionListener Example
Java
Controls
This code snippet shows how to add an ActionListener to a JMenu component.
JMenuBar Example
Java
Controls
This code snippet demonstrates how to use the JMenuBar component and how to add menu items using the JMenu and JMenuItem components.
MD5 Message Digest Example 1
Java
Security
This code snippet shows how to use the MessageDigest class to get an instance of the MD5 MessageDigest. This code snippet does not return a 32 character string.
Check If File Exists
Java
File Manipulation
This code snippet checks if a file exists. If it does, it displays its absolute file path. What Others Are Viewing
Highlight Input Element On Focus
Javascript
JQuery
This code snippet shows how to highlight an input element when it has focus and remove the highlight when it loses focus.
Sliding Tab Control
Javascript
JQuery
This code snippet shows how to develop a simple tab control, that slides tab pages when you click onto a tab.
LINQ Example 1
C#
LINQ
This code snippet uses where to find all elements of an array that is less than 10. |
Top C# SnippetsThis snippet shows how to develop a custom panel which is semi transparent by overriding CreateParams and the OnPaint method of the Panel control. TThis code snippet gets the filename and path of a selected file using the FileOpenDialog Class. This snippet adds items to a listview control. It loops through the files in the C:\ drive and displays the filename in the listview control. This sinppet opens an image for reading as bytes. The bytes are then placed into a memorystream which is used to create a bitmap image of the bytes. The image is then set as the forms background image. This snippet uses the TripleDESCryptoServiceProvider Class to encrypt a string and save it to a text file. The key to decrypt the file is also saved into a seperate text file. This code snippet gets the filename of a selected file from the Open File Dialog and displays it in a message box. This snippet checks to see if a file exists using the FileInfo Class. This code snippet will get the computers IP address. This simple snippet creates a connection to an SQLServer. This simple snippet demonstrates how to use the IEnumerable interface to loop through a custom collection using the foreach loop. |