Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I provide IntelliSense support for custom controls while coding against them and also provide Description support for the properties in the Property grid?

You can provide IntelliSense support for your type and its members by providing XML comments in code as follows:

using System.Windows.Forms;

/// <summary>
/// Summary description for CustomForm.
/// </summary>
public class CustomForm : Form
{
  /// <summary>
  /// Clean up any resources being used.
  /// </summary>
  protected override void Dispose( bool disposing )
  { /* ... */ }
  
  /// <summary>
  /// Summary description for Custom property.
  /// </summary>
  public int Custom { /* ... */ }

  // ...
}

See XML Documentation in the C# Programmers Reference in the MSDN Library. In particular, see the section on Recommended Tags for Documentation Comments.

Then in your project, go to the Project Properties dialog, to the Configuration Properties/Build tab and specify a file for the XML Documentation File property. This will generate a file by that name when you compile your assembly. Place this XML file beside your DLL. This will provide IntelliSense support for your types in that assembly.

To provide Description support for your properties in the property grid in the designer, add the Description attribute to your properties in code.

[ Description( "Custom property description" ) ]
public int Custom { /* ... */ }

Contributed from George Shepherd's Windows Forms FAQ