Take full advantage of the. NET Framework's PropertyGrid control (Microsoft) III

Source: Internet
Author: User
Tags contains integer advantage
Controls | Where Microsoft uses the PropertyGrid control
In many parts of your application, you can enable users to interact with PropertyGrid for a richer editing experience. For example, an application contains "settings" or options that multiple users can set, some of which can be complex. You can use radio buttons, combo boxes, or text boxes to represent these options. However, this step-by-step article describes how to use the PropertyGrid control to create an option window to set application options. The OptionsDialog form that is created above is the beginning of the Options window. Now we create a class named AppSettings that contains all the properties that map to the application settings. If you create a separate class without using multiple dispersed variables, the settings are easier to manage and maintain.

' Visual Basic

Public Class AppSettings
Private _saveonclose as Boolean = True
Private _greetingtext as String = "Welcome to the application!" "
Private _maxrepeatrate as Integer = 10
Private _itemsinmru as Integer = 4

Private _settingschanged as Boolean = False
Private _appversion as String = "1.0"

Public Property saveOnClose () as Boolean
Get
Return _saveonclose
End Get
Set (ByVal Value as Boolean)
saveOnClose = Value
End Set
End Property

Public Property Greetingtext () as String
Get
Return _greetingtext
End Get
Set (ByVal Value as String)
_greetingtext = Value
End Set
End Property

Public Property Itemsinmrulist () as Integer
Get
Return _itemsinmru
End Get
Set (ByVal Value as Integer)
_itemsinmru = Value
End Set
End Property

Public Property maxRepeatRate () as Integer
Get
Return _maxrepeatrate
End Get
Set (ByVal Value as Integer)
_maxrepeatrate = Value
End Set
End Property

Public Property settingschanged () as Boolean
Get
Return _settingschanged
End Get
Set (ByVal Value as Boolean)
_settingschanged = Value
End Set
End Property

Public Property appversion () as String
Get
Return _appversion
End Get
Set (ByVal Value as String)
_appversion = Value
End Set
End Property
End Class




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.