C# Events 17 August 2001 at 00:00
Adding a simple event to your C# class is extremely easy. For example, you have created a text box and you want to trigger an event whenever the file is saved to it's container can keep track of this information.

Firstly, you need to add a public event to your text box class - extending the System.EventHandler class will suffice for simple events.

  public class YourClass 
  {
    public event System.EventHandler FileSaved;
    ...
Second, in your texbox class, add the call to this method in the function(s) where the method needs to be raised:
  public virtual new void SaveFile(string strFilePath) 
  {
    ...
    this.FileSaved(this, new EventArgs());
  }
Finally, in your container class you add event handling behaviour as you would for any standard control event
  ...
  this.textBox.FileSaved += new System.EventHandler(this.event_textBox_FileSaved);

  ...

  // file saved
  private void event_textBox_FileSaved(object sender, System.EventArgs e)
  {
    // event handling code
  }

C# : Drag and Drop Files 20 August 2001 at 00:00
When coding drag and drop operations in C# Windows applications, you need to complete two steps. Firstly, add a DragOver event to your form in which you change the cursor over your target application so the user can see they will copy the dragged object on the form:
  private void event_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
  {
    e.Effect = DragDropEffects.Copy;
  }
The second step involves handling the actual dropping of the file. This is done by adding a DragDrop event to your form, and retrieving the string array which Windows passes to your application containing the names of all the files dragged and dropped:
  private void event_DragDrop(object sender, DragEventArgs e) 
  {
    // get reference to the dataobject
    DataObject dataObj = (DataObject)e.Data;
    // convert into array of file names
    string[] files = (string[])(dataObj.GetData(DataFormats.FileDrop));
    // loop through each argument, performing the appropriate file opening
    for (int i=0; i<files.Length; i++) 
    {
      this.OpenFile(files[i]);
    }
  }
C#: Opening external applications 22 August 2001 at 00:00
Opening files from within your application that you do not want to handle within the application itself is really simple using the System.Diagnostics namespace.

Eg: to open the user's default browser to a web site:

  try 
  {
    System.Diagnostics.Process.Start("http://yoursite.com");
  }
  catch (Exception) 
  {
    // error handling
  }

Eg: To open the user's mail client to send mail to someone:

  try 
  {
    System.Diagnostics.Process.Start("mailto: someone@somewhere.com");
  }
  catch (Exception) 
  {
    // error handling
  }

Eg: To open a gif file:

  try 
  {
    System.Diagnostics.Process.Start("C:/YourFile.gif");
  }
  catch (Exception) 
  {
    // error handling
  }
Dragging and dropping files between your windows applications 20 August 2001 at 00:00
When coding drag and drop operations in C# Windows applications, you need to complete two steps. Firstly, add a DragOver event to your form in which you change the cursor over your target application so the user can see they will copy the dragged object on the form:
  private void event_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
  {
    e.Effect = DragDropEffects.Copy;
  }

The second step involves handling the actual dropping of the file. This is done by adding a DragDrop event to your form, and retrieving the string array which Windows passes to your application containing the names of all the files dragged and dropped:
  private void event_DragDrop(object sender, DragEventArgs e) 
  {
    // get reference to the dataobject
    DataObject dataObj = (DataObject)e.Data;
    // convert into array of file names
    string[] files = (string[])(dataObj.GetData(DataFormats.FileDrop));
    // loop through each argument, performing the appropriate file opening
    for (int i=0; i
Object Oriented Analysis and Design Concepts 01 August 2001 at 00:00
Abstraction
The process of modelling real-world objects. When you create a class you create an abstraction of a real-world object (like a dictionary definition of that real-world object).

Encapsulation
The property of being a self-contained unit is called encapsulation. With encapsulation, we can accomplish data hiding. Data hiding is the highly valued characteristic that an object can be used without the user knowing or caring how it works internally. Just as you can use a refrigerator without knowing how the compressor works, you can use a well-designed object without knowing about its internal data members.

Inheritance
When an object is derived from another object. It inherits all the properties etc. of the parent object, but can also add to them as needed.

Polymorphism
Different objects do "the right thing" through what is called function polymorphism and class polymorphism. Poly means many, and morph means form. Polymorphism refers to the process whereby an object invokes a method of another object in a common manner (with the same name) without understanding or caring how it is accomplished.