The code below does not work, the error says the method ValidateSettings
does not have a signature compatable with delgate ' Delgate Sub SettingChangingEventHandler(sender as Object, e as SettingChangingEventArgs)
'
This error shows up when hovering over [...] AddressOf ValidateSettings
Private Sub ValidateSettings(sender As Object, e As SettingChangingEventArgs)
End Sub
Private Sub frm_Settings_Load(sender As Object, e As EventArgs) Handles MyBase.Load
AddHandler My.Settings.SettingChanging, AddressOf ValidateSettings
PropertyGrid_Settings.SelectedObject = My.Settings
CenterToParent()
End Sub
The solution was to add Imports System.Configuration
to the class, as pointed out by a comment on the original post.
Imports System.Configuration
Public Class frm_Settings
Private Sub ValidateSettings(sender As Object, e As SettingChangingEventArgs)
'validation and notifying user
MsgBox(e.NewValue)
End Sub
Private Sub frm_Settings_Load(sender As Object, e As EventArgs) Handles MyBase.Load
AddHandler My.Settings.SettingChanging, AddressOf ValidateSettings
PropertyGrid_Settings.SelectedObject = My.Settings
CenterToParent()
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.