2019-04-15 14:30:00 +02:00

42 lines
1.6 KiB
VB.net

Imports DevExpress.XtraEditors
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.ClientSuite.Base
Imports DigitalData.Modules.Logging
Namespace Controls
Public Class ControlData
Inherits BaseClass
Public Sub New(LogConfig As LogConfig)
MyBase.New(LogConfig)
End Sub
Public Sub LoadControlData(ByRef Controls As List(Of BaseEdit), Data As DataTable)
Dim oCounter = 0
' TODO: Do we need databinding and does it work with lookup control
For Each oControl As BaseEdit In Controls
Dim oBindingSource As New BindingSource(Data, Nothing)
Select Case oControl.GetType
Case GetType(TextEdit)
oControl.DataBindings.Add("Text", oBindingSource, "CTRLVALUE", True, DataSourceUpdateMode.OnPropertyChanged)
Case GetType(MemoEdit)
oControl.DataBindings.Add("Text", oBindingSource, "CTRLVALUE", True, DataSourceUpdateMode.OnPropertyChanged)
Case GetType(DateEdit)
oControl.DataBindings.Add("Text", oBindingSource, "CTRLVALUE", True, DataSourceUpdateMode.OnPropertyChanged)
Case GetType(LookupControl2)
oControl.DataBindings.Add("Text", oBindingSource, "CTRLVALUE", True, DataSourceUpdateMode.OnPropertyChanged)
Case Else
End Select
oBindingSource.Position = oCounter
oCounter += 1
Next
End Sub
End Class
End Namespace