jj 14.03 add props for dgv, new value structure for clb

This commit is contained in:
JenneJ
2016-03-14 15:16:04 +01:00
parent 65ff842c1e
commit 0f271342b6
4 changed files with 105 additions and 13 deletions

View File

@@ -66,7 +66,7 @@
If IsNothing(staticList) Or String.IsNullOrWhiteSpace(staticList) Then
Return Nothing
Else
Return New List(Of String)(staticList.Split(";"))
Return New List(Of String)(staticList.Split(";").ToArray())
End If
Catch ex As Exception
MsgBox("Error in CheckForStaticList: " & vbNewLine & ex.Message)
@@ -74,7 +74,7 @@
End Try
End Function
Private Shared Function GetSqlList(controlId As Integer, formId As Integer, connection_Id As Object, sqlCommand As String)
Public Shared Function GetSqlList(controlId As Integer, formId As Integer, connection_Id As Object, sqlCommand As String) As DataTable
Try
If sqlCommand Is Nothing Or sqlCommand = String.Empty Then
Return Nothing
@@ -178,6 +178,10 @@
control.DataSource = dt
End Sub
Overloads Shared Sub SetDataSource(control As Windows.Forms.DataGridView, dt As DataTable)
control.DataSource = dt
End Sub
End Class
Public Structure DynamicValue
@@ -333,13 +337,11 @@
Public Class CheckedListBox : Inherits _ListControl
Public Shared Sub LoadValue(control As DevExpress.XtraEditors.CheckedListBoxControl, value As String)
If IsNothing(value) Then
Public Shared Sub LoadValue(control As DevExpress.XtraEditors.CheckedListBoxControl, values As List(Of Object))
If IsNothing(values) Then
Exit Sub
End If
Dim values() As String = value.Split(";")
For Each v As String In values
Dim pos = control.FindStringExact(v)
If pos >= 0 Then
@@ -391,4 +393,26 @@
End Class
Public Class DataGridView : Inherits _ListControl
Public Shared Sub LoadList(control As Windows.Forms.DataGridView, formId As Integer, ConnId As Object, SQLCommand As String)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, ConnId, SQLCommand)
' SQLCommand ignorieren
If dynamic.StaticList IsNot Nothing Then
Dim bindingSource As New BindingSource()
For Each item As String In dynamic.StaticList
bindingSource.Add(item)
Next
'control.DataSource = dynamic.StaticList
control.DataSource = bindingSource
End If
End Sub
End Class
End Namespace