From ae9613d56e988a8e9c73817bfc6e773ec591b704 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 30 Jan 2020 14:27:28 +0100 Subject: [PATCH] strange stuffs --- app/DD_PM_WINDREAM/ClassControlCreator.vb | 35 +++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/app/DD_PM_WINDREAM/ClassControlCreator.vb b/app/DD_PM_WINDREAM/ClassControlCreator.vb index e4cc0bc..60a979a 100644 --- a/app/DD_PM_WINDREAM/ClassControlCreator.vb +++ b/app/DD_PM_WINDREAM/ClassControlCreator.vb @@ -481,14 +481,17 @@ Public Class ClassControlCreator Next - oControl.DataSource = oDatatable + Dim oSource As New BindingSource() With {.DataSource = oDatatable} + + oControl.DataSource = oSource oControl.RefreshDataSource() oControl.ForceInitialize() - Dim oGridView As GridView = oControl.DefaultView + oView.PopulateColumns() + For Each oRow As DataRow In DT_MY_COLUMNS.Rows Dim o = oRow.Item("SPALTENNAME") Dim p = oRow.Item("SPALTENBREITE") - Dim ocount = oGridView.Columns.Count + Dim ocount = oView.Columns.Count ' oGridView.Columns(oRow.Item("SPALTENNAME")).Width = oRow.Item("SPALTENBREITE") Next @@ -501,8 +504,7 @@ Public Class ClassControlCreator If GridTables.ContainsKey(e.Column.FieldName) Then Dim oComboboxDataTable As DataTable = GridTables.Item(e.Column.FieldName) - 'Dim oEditor As New RepositoryItemComboBox() - Dim oEditor As New RepositoryItemLookUpEdit() + Dim oEditor As New RepositoryItemComboBox() Dim oItems As New List(Of String) AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs) @@ -513,14 +515,35 @@ Public Class ClassControlCreator End If End Sub + For Each oRow2 As DataRow In oComboboxDataTable.Rows + Dim oValue = oRow2.Item(0) + + Try + oValue &= $" | {oRow2.Item(1)}" + Catch ex As Exception + End Try + + oEditor.Items.Add(oValue) + oItems.Add(oValue) + Next - oEditor.DataSource = oComboboxDataTable e.RepositoryItem = oEditor End If End If Next End Sub + AddHandler oView.CellValueChanged, Sub(sender As Object, e As CellValueChangedEventArgs) + Dim oValue = e.Value.ToString() + Dim oView2 As GridView = TryCast(sender, GridView) + + + If oValue.Contains(" | ") Then + oValue = oValue.Split(" | ").ToList().Item(0) + oView2.SetRowCellValue(e.RowHandle, e.Column, oValue) + End If + End Sub + Return oControl End Function