Dot Net

C# Database Audit/History Tracking

This is a simple method of history tracking of database changes that in done within in the application. There are other methods to do this including creating triggers within the database itself.

Basically this is one small function that you pass in a dataset and transaction. It loops through each table and each row and column in the table and detects the current state of the row and records it in an audit table.

Download Example

Simple download file example. Works with http, https, and ftp. If username and password are required add them to the client using System.Net.NetworkCredential("username", "password").

Use the WebClient DownloadProgressChanged and DownloadFileCompleted events to display percent and start on finish action.

These examples will not work unless you create a winform to go along with them.

VB.net

Imports System.IO
Imports System.Net
Imports System.Threading
Imports System.Text

Public Class Form1

Backgroundworker ReportProgress / Tooltip balloon Messages

The following code is a partial example of using backgroundworker ReportProgress method to access controls from the backgroundworker thread.

The form has one button called Button2. When the form is activated it creates a balloon tooltip message for 5 seconds on it.

These examples will not work unless you create a winform to go along with them.

VB.NET Example

Imports System.ComponentModel
Public Class Form1

    Dim bwCheckForUpdates As BackgroundWorker

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

GTK# MessageDialog

	
MessageDialog m = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.YesNo, false, 
    "Should the textbox be set to Hello World");
ResponseType result = (ResponseType)m.Run();
m.Destroy();
		
if (result == ResponseType.Yes)
{
	entry1.Text = "Hello World";
}

Directory Traversal in C#

I am reading through a chapter on binary trees. The first simple example they give is traversing through directory structures. As the book is for java the attached file is the example translated to c#.

Once I have finished the chapter I will upload the binary tree example translated to c#.

Here is an example postorder recursion through a directory tree (attachment main.cs). See attachment Main.cs for a different example.

class RecurseDirectory
{
	public static void Main(string[] args)
	{
		RecurseDirectory r = new RecurseDirectory();
Syndicate content