Imports System.ComponentModel 'Imports System.ComponentModel.Design Imports System.Drawing.Design 'Imports System.Windows.Forms Imports System.Windows.Forms.Design Namespace Controls.Editors Public Class DatasourceEditor Inherits UITypeEditor Public Overrides Function GetEditStyle(context As ITypeDescriptorContext) As UITypeEditorEditStyle Return UITypeEditorEditStyle.Modal End Function Public Overrides Function EditValue(context As ITypeDescriptorContext, provider As IServiceProvider, value As Object) As Object Dim oService As IWindowsFormsEditorService = TryCast(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService) Dim oDatasource As DatasourceType = DirectCast(value, DatasourceType) If oService IsNot Nothing AndAlso oDatasource IsNot Nothing Then Using oForm As New frmDatasourceEditor() oForm.Value = oDatasource If oService.ShowDialog(oForm) = DialogResult.OK Then value = oForm.Value End If End Using End If Return value End Function End Class Public Class DatasourceTypeConverter Inherits TypeConverter Public Overrides Function ToString() As String Return MyBase.ToString() End Function ' Diese Funktion gibt den String zurück, der im PropertyGrid für den Benutzer sichtbar ist, kann ruhig etwas hübscher sein als foo;bar;baz Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As Globalization.CultureInfo, value As Object, destinationType As Type) As Object Return "Datasource" End Function End Class End Namespace