Salve a tutti, ho realizzato una classe che eredita da stringCollection per aggiungere degli eventi e la inserisco in un controllo button come proprietà. Il problema è che quando, in modalità progettazione aggiungo il controllo e provo ad editare la proprietà stringcollection mi da l'errore "impossibilie trovare il costruttore sul tipo System.String". Come posso risolvere?
Questo è il codice della classe che eredita da StringCollection :
E questo è la parte di codice dove utilizzo la classe in una proprietà:codice:Public Class StringsCollection Inherits Specialized.StringCollection Event Adding(ByVal sender As Object, e As CancelEventArgs) Event Added(ByVal sender As Object, e As EventArgs) Event Removed(ByVal sender As Object, e As EventArgs) Public Sub New() MyBase.New End Sub Public Sub New(strings As String()) MyBase.New For i As Integer = 0 To strings.Length - 1 Add(strings(i)) Next End Sub Public Shadows Sub Add(testi As String()) For i As Integer = 0 To testi.Length - 1 Add(testi(i)) Next End Sub Public Shadows Sub Add(testo As String) Dim e As New CancelEventArgs RaiseEvent Adding(Me, e) If Not e.Cancel Then MyBase.Add(testo) Else Exit Sub RaiseEvent Added(Me, New EventArgs) End Sub Public Shadows Sub Remove(testo As String) MyBase.Remove(testo) RaiseEvent Removed(Me, New EventArgs) End Sub End Class
codice:Private WithEvents _MenuVoice As New StringsCollection Public ReadOnly Property MenuVoice As StringsCollection Get Return _MenuVoice End Get End Property

Rispondi quotando
