Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Accessing Data
 How to: Extend the Functionality of...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Data Access in Client and Middle-Tier Programming 
How to: Extend the Functionality of a Dataset 

You can extend the functionality of typed datasets by writing code into the dataset's partial class file.

The code that defines typed datasets is regenerated when changes are made in the Dataset Designer or when changes are made during the running of any of the wizards that create or modify objects in the dataset; for example, the Data Source Configuration Wizard, and the TableAdapter wizards. To prevent your code from being deleted during regeneration of the dataset, add code to the dataset's partial class file. (Partial classes allow code for a specific class to be divided among multiple physical files. For more information, see Partial (Visual Basic) or partial (C# Reference).)

To create the dataset's partial class file and add validation code, double-click columns and tables, which result in the generation of ColumnChanging and RowChanging event handlers. For more information, see How to: Validate Data During Column Changes and How to: Validate Data During Row Changes.

To add code to a typed dataset's partial class file

  1. Open the dataset in the Dataset Designer. For more information, see How to: Open a Dataset in the Dataset Designer.

  2. Double-click the design surface in an empty area to open the dataset's partial class file in the code editor.

  3. Add your code to the dataset's partial class file.

    NoteNote

    The code in the partial class file and the generated dataset class file is compiled into one class, so variable, property, and method names, and so on must be unique across all files that define the dataset, or compiler errors will occur.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Unable to open partial class      blarggstar2 ... Noelle Mallory - MSFT   |   Edit   |  

I am double clicking away on the design surface and nothing is happening? Why does this happen sometimes?

When the DataSet is in a web sites App_Code folder, double clicking the design surface does nothing.

When it is in a Class Library, double clicking works.

Is this behavior optional?

[Noelle Mallory - MSFT] Please post questions to the MSDN Forums at http://forums.microsoft.com/msdn. You will likely get a quicker response through the forum than through the Community Content.

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker