Originally posted by Ralf Jansen
View Post
[highlight=vbnet] Public Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object
Dim _SelectValue As String = System.Guid.Empty.ToString
If context Is Nothing _
OrElse provider Is Nothing _
OrElse context.Instance Is Nothing Then
Return MyBase.EditValue(provider, value)
End If
Try
edSvc = CType(provider.GetService(GetType(IWindowsFormsEdi torService)), IWindowsFormsEditorService)
' Wenn die Instanzierung erfolgreich war
If edSvc IsNot Nothing = True Then
Dim _Control As XListBox = New XListBox ' erweitertes UserControl, damit man IdemData nutzen kann
Dim _dtCongregations As New MYKEY.CongAdminFX.Common.dsCongAdminCongregations. CongAdminFXCongregationsDataTable
Dim _adCongregations As MYKEY.CongAdminFX.Common.dsCongAdminCongregationsT ableAdapters.CongAdminFXCongregationsTableAdapter
Dim _rowCongregations As MYKEY.CongAdminFX.Common.dsCongAdminCongregations. CongAdminFXCongregationsRow
' Auslesen der Daten aus der Datenbank
_adCongregations = New MYKEY.CongAdminFX.Common.dsCongAdminCongregationsT ableAdapters.CongAdminFXCongregationsTableAdapter
With _adCongregations
.Connection.ConnectionString = MYKEY.FX.Interface.Application.DB_CONNECTION
.Fill(_dtCongregations)
End With
' Anpassen und Füllen der Listbox
AddHandler _Control.MouseDoubleClick, AddressOf XList_MouseDoubleClick
If _dtCongregations.Rows.Count > 0 Then
For Each _rowCongregations In _dtCongregations.Rows
Controls.VB2005.AddListBoxItem(_Control, _rowCongregations.CongName, _rowCongregations.CongGUID)
Next
End If
' Öffnen und anzeigen der Liste zur Auswahl
edSvc.DropDownControl(_Control)
' Ermitteln des Wertes, der geschrieben werden soll
_SelectValue = Controls.VB2005.GetItemData(_Control, _Control.SelectedIndex)
End If
Catch ex As Exception
Throw New Exception("Error in EditValue Routine")
End Try
Return _SelectValue
End Function[/highlight]
Comment