Subscribe: Dave on C-Sharp
http://www.daveoncsharp.com/feed/
Preview: Dave on C-Sharp

Dave on C-Sharp



C# Programming Tutorials



Last Build Date: Mon, 19 Oct 2015 06:28:19 +0000

 



Binding a Windows Forms ComboBox in C#

Sun, 29 Nov 2009 18:18:07 +0000

Most often when reading the selected item of a bound combobox you will need more information than just the selected text or the selected index of the combo. For example, if you have a combobox bound to a user table in your database, you will most probably want to have the full user name displayed […]



C# Escape Sequence Listing

Tue, 10 Nov 2009 19:29:48 +0000

What is an escape sequence? Well, put simply, an escape sequence is a series of special characters which are interpreted by the compiler as a command. In other words, they suspend the normal processing to perform some special function. In C#, escape sequences are represented by a ‘\’ (backslash) followed by a letter or a […]



Retrieving Data From a MySQL Database

Sat, 07 Nov 2009 19:13:29 +0000

In this article I am going to show you how to programmatically retrieve data from a MySQL database using the MySqlDataAdapter and the MySqlDataReader classes. Both these classes are available once you install the MySQL Connector for .NET which can be downloaded from here: MySQL Connectors. For this example we need a database with some […]



Connecting to a MySQL Database Programmatically

Sun, 18 Oct 2009 20:03:15 +0000

Microsoft Visual Studio lets you create a database connection using its IDE, and it’s quite powerful as well, but personally I prefer to create my database connections programmatically. When creating my connection’s code manually I find it easier to follow the code, plus it can be easier to debug as well. I am by no […]



New ASCII Codes Page

Wed, 07 Oct 2009 20:59:58 +0000

I have added a new page to this blog called ASCII Codes, which can be accessed from the navigation bar at the top of the page. This new page is intended as a reference guide which you can use to look up an ascii code’s decimal, hexadecimal, and html values. There is also a description […]



How to Capture System Events using C#

Mon, 05 Oct 2009 20:06:19 +0000

What are system events? Well, basically they are events raised by the operating system when a user performs an action which affects the operating environment. System events are accessible through the Microsoft.Win32.SystemEvents class. SystemEvents Events Below is a list of all the system events found within the SystemEvents class. Name Description DisplaySettingsChanged Occurs when the […]



Enumerating and Controlling Windows Services with C#

Fri, 02 Oct 2009 19:05:17 +0000

The Microsoft.NET Framework contains a component called the ServiceController. It is designed to allow you to control a Windows Service. With this component you can easily start, stop, and pause services, and you can also retrieve information on the service such as its display name and status among others. In this article I am going […]



How to use Temporary Files in C#

Wed, 30 Sep 2009 20:34:34 +0000

What exactly is a temporary file? Put simply, a temporary file is a file used by an application for storing temporary data. There is no fixed rule which specifies what this data should be, but generally temporary files (or temp files) are used for storing ‘work data‘. For example Microsoft Office uses temp files to […]



Monitoring the File System for Changes

Mon, 28 Sep 2009 21:17:04 +0000

In this article I am going to show you how to monitor a folder for changes. A reason why you might want to do this is for example if you want to keep two files in different locations in sync. When the original file is changed it would trigger an event and you can update […]



Formatting Decimals in C#

Wed, 23 Sep 2009 21:29:44 +0000

In this post I am going to show you a few different ways how you can format a decimal number (float, double, or decimal). Setting the Maximum Allowed Decimal Places To format your numbers to a maximum of two decimal places use the format string {0:0.##} as shown in the below example: string.Format("{0:0.##}", 256.583); // […]