As you can see in the get/set accessors we are referring to the settings file we just created. What each attribute is is pretty self explanatory. I've added attributes that help describe how this will display in the property grid. I've only added one item, but you can add as many as you like. Return base.GetDisplayText( string.Format( " Protected override string GetDisplayText( object value) Public EmployeeCollectionEditor(Type type) Public class EmployeeCollectionEditor : CollectionEditor I've created a class called EmployeeCollection that looks like the following: We can do this by adding another class to our class library project ( Organization). Now that I've created the item my collection will be made of I can now create the collection ( EmployeeCollection). I will discuss this later in the article. I've added attributes to the code to control how these items will look in the property grid. I've created a class called Employee that looks like the following:īasically, the block of code creates the information we want to store about each employee and then creates accessible properties to retrieve and save this information. Once the class library is created we will need to add a new class that holds the individual item (Employee) that we will later make a collection of. This new project will be a class library (Organization). Within the new solution you created we need to add a new project. Now that we've created the file we will push it aside for later. The settings file should be moved under the Properties folder. You will want create a new Windows App project and add a new Settings file to the project ( ttings). The first thing we need to do is create a settings file. Creating the property grid that holds our new collection.Creating the individual item we want to store in a collection.In order to make this work there are a few things that the application must have. This code demonstrates how to create a custom collection that can be edited and saved to the app.config file via the property grid control. I needed to figure out how to store settings from a custom collection and persist the settings. The only problem was a lot of the information I wanted to store in the app.config file didn't fit the standard types. Using the property grid and user settings via the app.config file I was able to accomplish this. I didn't want to have to account for every single database query. I wanted the user to be able to modify query settings on their own. Each team accessed different databases and different schemas. There are also many different users that access the application (DEV, QA, Business Teams). The application needed to be very dynamic since pieces of the database were always changing. I've been working a lot lately on a database application at my current client.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |