C# / .NET
I picked up C# and some ideas about .NET when I converted this site from ASP. Here some notes on these new technologies.
Remoting callbacks and events in .NET 2.0
This is the simplest application I could create to demonstrate remoting events. The client can call the server as in simple remoting or web services. However the magic of this article is in the servers ability to call the client.
EnableVisualStyles and SEHExceptions
EnableVisualStyles is a nasty little command that can cause completely unrelated errors. Here is an account of the troubles it can cause.
Copy Image to Clipboard
Here we will place and Image type object into the clipboard for sharing with other application that can receive images from the clipboard.
Capture the Screen to an Image
Capture the client area of a form to an Image type object. We also save this image to disk.
Introduction to Enum
Simple introduction to the use of enum. Enum is a simple way to make code more readable and with intellisence, simpler to write.
A simple WebForm example using UTM and Lat/Long.
This sample converts Latitude and Longitude values into UTM Northings and Eastings. In the process it demonstrates the use of a Simple WebForm events firing back to the server.
Writing Date and Time to MS Access database
The Visual Studio.NET wizard only allows dates to be written to a Date / Time column in MS Access. This is a work around.
A simple example to create a client and server communication using remoting. This example does not use configuration files.
Simple wrapper class to expose the Design FolderBrowser. Useful when prompting the user to browse for a folder.
Converting Image or BLOB data to a string
Converting byte arrays to string allows us to store large binary data in text fields such as MS Access memo fields. This way we can store images downloaded to a web server.
Saving an Image in JPEG format
A simple method that saves an Image type object as a JPEG image with the desired compression ration.
Using a Manifest to get XP style controls.
Demonstrate how to get Windows XP type colourful controls by using a Manifest to force loading Comctl32.dll version 6
A Simple Colour Picking ComboBox using OwnerDraw and Reflection.
This simple tutorial demonstrates the using an Owner Draw ComboBox to allow the user to select from a prefined set of colours. The colours are gathered by enumerating the Color and KnowColor objects.
Using Sockets in C#
An article the creates a chat client and server using Sockets to communicate using TCP/IP. One of the features of this example is it use of delegates to produce asynchronous connections and communications.
Macro to switch between .CPP and .H file with a singple button press.
This macro was written in VB and enables switching between the .CPP and .H files of the same class for C++ files. It is for use with VisualStudio.NET beta 2.
Simple Drap and Drop of items in a Tree control.
This is a poor demonstration of how to implement drag and drop in a tree control to move items and whole branchs arround in a tree control. It does not support moving to other controls or windows.
Extract a GIF image from a SQL Server database for display in a web browser.
Here we will extract a BLOB (representing a GIF image) from a SQL server database and display it in a web browser and embedded in a web page. This will be done without saving the image to an intermediate file.
Simple ADO Database Read, Insert, Update and Delete using C#.
An easy introduction to accessing databases using the ADO classes. It includes how to read and write integers, strings and dates.
Populating the DataGrid
The DataGrid control in WinForms is a very powerful and complete item. These code samples describe how to populate the underlaying DataSet manually or from database table.
Lets get threading.
This simple code segement shows how to create new thread of execution and how to sychronise a section of the shared code.
Processing an Exception to display the call stack.
A short piece of code using reflection to display the call stack in an exception handler.
Reading, Writing and Appending to simple text files in C#.
Three short code samples to perform the most basic of text operations. Reading from a file, writing to a new file and appending to an existing file.
Creating and displaying a simple dialog box, modeless and modal.
This simple tutorial will guide you the process of adding and displaying a simple dialog / form in your application. It covers both modal and modeless dialogs.
Using the new foreach command.
foreach is a new command for C and C++ developers new to the C# world. It allows objects to be iterated through.
How to Call a COM object from C#.
This is a very simple task that can be used to use code written in a verity of languages.
C# Dates and Times
How to use and format dates and times in C#.