Imports DevExpress.XtraEditors Imports DevExpress.XtraLayout Imports DigitalData.Controls.LookupGrid Imports DigitalData.Modules.Logging Public Class ClassControlLoader Inherits BaseClass Public Sub New(LogConfig As LogConfig) MyBase.New(LogConfig) End Sub Public Sub LoadControls(Datatable As DataTable, LayoutControlGroup As LayoutControlGroup) For Each oRow As DataRow In Datatable.Rows Dim oCaption As String = oRow.Item("COLNAME") Dim oControlType As String = oRow.Item("CTRLTYPE") Dim oControlId As String = oRow.Item("RECORD_ID").ToString Dim oEditor As BaseEdit = CreateLayoutControl(oControlType, oControlId) If oEditor Is Nothing Then Continue For End If LayoutControlGroup.AddItem(oCaption, oEditor) Next LayoutControlGroup.AddItem(New EmptySpaceItem()) End Sub Public Function CreateLayoutControl(Type As String, Name As String) Dim oEditor As BaseEdit = Nothing Logger.Debug("Create new Control of type {0} with name {1}", Type, Name) Select Case Type Case ClassConstants.CONTROL_TEXTEDIT Dim oTextEdit As New TextEdit() With {.Name = Name} oEditor = oTextEdit Case ClassConstants.CONTROL_MEMOEDIT Dim oMemoEdit As New MemoEdit() With {.Name = Name} oEditor = oMemoEdit Case ClassConstants.CONTROL_DATEEDIT Dim oDateEdit As New DateEdit() With {.Name = Name} oEditor = oDateEdit Case ClassConstants.CONTROL_CHECKEDIT Dim oCheckEdit As New CheckEdit() With {.Name = Name} oEditor = oCheckEdit Case ClassConstants.CONTROL_COMBOEDIT Dim oComboEdit As New LookupControl2() With {.Name = Name} oEditor = oComboEdit Case Else oEditor = Nothing End Select Return oEditor End Function End Class