From 8dadf1ff301feb46486e671cac0818c67a1f8058 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 11 Apr 2019 15:48:12 +0200 Subject: [PATCH] Replace old stinky Table with fancy GridControl --- app/DD_PM_WINDREAM/ClassControlCreator.vb | 83 ++++--- app/DD_PM_WINDREAM/ModuleControlProperties.vb | 7 + app/DD_PM_WINDREAM/frmFormDesigner.vb | 80 ++++-- app/DD_PM_WINDREAM/frmValidator.Designer.vb | 12 +- app/DD_PM_WINDREAM/frmValidator.resx | 2 +- app/DD_PM_WINDREAM/frmValidator.vb | 234 +++++++++++------- 6 files changed, 259 insertions(+), 159 deletions(-) diff --git a/app/DD_PM_WINDREAM/ClassControlCreator.vb b/app/DD_PM_WINDREAM/ClassControlCreator.vb index ab81838..adddf9c 100644 --- a/app/DD_PM_WINDREAM/ClassControlCreator.vb +++ b/app/DD_PM_WINDREAM/ClassControlCreator.vb @@ -1,4 +1,7 @@ Imports DD_LIB_Standards +Imports DevExpress.Utils +Imports DevExpress.XtraGrid +Imports DevExpress.XtraGrid.Views.Grid Imports DigitalData.Controls.LookupGrid Public Class ClassControlCreator @@ -25,6 +28,7 @@ Public Class ClassControlCreator Public Const PREFIX_TABLE = "TB" Public Const PREFIX_LINE = "LINE" + ''' ''' Standard Eigenschaften für alle Controls ''' @@ -168,30 +172,22 @@ Public Class ClassControlCreator Return control End Function - - Public Shared Function CreateNewTable(location As Point) As DataGridView - Dim control As New DataGridView With { + Public Shared Function CreateNewTable(location As Point) As GridControl + Dim oControl As New GridControl With { .Name = $"{PREFIX_TABLE}_{clsTools.ShortGuid}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT_TABLE), .Cursor = Cursors.Hand, - .Location = location, - .AllowUserToAddRows = False, - .AllowUserToDeleteRows = False, - .AllowUserToResizeColumns = False, - .AllowUserToResizeRows = False + .Location = location } + Dim oView As GridView = oControl.DefaultView + oView.OptionsView.ShowGroupPanel = False - control.Columns.Add(New DataGridViewTextBoxColumn With { - .HeaderText = "Column1", - .Name = "column1" - }) - - control.Columns.Add(New DataGridViewTextBoxColumn With { - .HeaderText = "Column2", - .Name = "column2" - }) + Dim oDatatable As New DataTable() + oDatatable.Columns.Add("column1", GetType(String)) + oDatatable.Columns.Add("column2", GetType(String)) + oControl.DataSource = oDatatable - Return control + Return oControl End Function Public Shared Function CreateNewLine(location As Point) As LineLabel @@ -319,31 +315,46 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateExistingTable(row As DataRow, columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow), designMode As Boolean) As DataGridView - Dim control As DataGridView = CreateBaseControl(New DataGridView(), row, designMode) + Public Shared Function CreateExistingTable(row As DataRow, columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow), designMode As Boolean) As GridControl + Dim oControl As GridControl = CreateBaseControl(New GridControl(), row, designMode) + Dim oDatatable As New DataTable + Dim oView As GridView - control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT")) - control.AllowUserToAddRows = False - control.AllowUserToDeleteRows = False - control.AllowUserToResizeColumns = False - control.AllowUserToResizeRows = False - For Each column As DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow In columns - Dim col As New DataGridViewTextBoxColumn() With { - .HeaderText = column.SPALTEN_HEADER, - .Name = column.SPALTENNAME, - .Width = column.SPALTENBREITE - } - control.Columns.Add(col) - Next + oControl.ForceInitialize() + + oView = oControl.DefaultView + oView.OptionsView.ShowGroupPanel = False If Not designMode Then - control.Enabled = Not row.Item("READ_ONLY") - control.TabStop = Not row.Item("READ_ONLY") + oView.OptionsBehavior.Editable = Not row.Item("READ_ONLY") + oView.OptionsBehavior.ReadOnly = row.Item("READ_ONLY") + + If row.Item("VKT_ADD_ITEM") = True Then + oView.OptionsBehavior.AllowAddRows = DefaultBoolean.True + oView.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom + Else + oView.OptionsBehavior.AllowAddRows = DefaultBoolean.False + oView.OptionsView.NewItemRowPosition = NewItemRowPosition.None + End If End If - Return control + oControl.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT")) + + For Each oRow As DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow In columns + Dim oColumn = New DataColumn() With { + .DataType = GetType(String), + .ColumnName = oRow.SPALTENNAME, + .Caption = oRow.SPALTEN_HEADER + } + + oDatatable.Columns.Add(oColumn) + Next + + oControl.DataSource = oDatatable + + Return oControl End Function Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel diff --git a/app/DD_PM_WINDREAM/ModuleControlProperties.vb b/app/DD_PM_WINDREAM/ModuleControlProperties.vb index fc754ad..f9d4a49 100644 --- a/app/DD_PM_WINDREAM/ModuleControlProperties.vb +++ b/app/DD_PM_WINDREAM/ModuleControlProperties.vb @@ -314,6 +314,13 @@ Public Module ModuleControlProperties Inherits InputProperties End Class + Public Class GridControlProperties + Inherits InputProperties + + + Public Property AllowAddNewValues As Boolean + End Class + Public Class LookupControlProperties Inherits InputProperties diff --git a/app/DD_PM_WINDREAM/frmFormDesigner.vb b/app/DD_PM_WINDREAM/frmFormDesigner.vb index bcf4236..9121989 100644 --- a/app/DD_PM_WINDREAM/frmFormDesigner.vb +++ b/app/DD_PM_WINDREAM/frmFormDesigner.vb @@ -1,5 +1,9 @@ Imports System.ComponentModel Imports DD_LIB_Standards +Imports DevExpress.XtraGrid +Imports DevExpress.XtraGrid.Columns +Imports DevExpress.XtraGrid.Views.Grid +Imports DevExpress.XtraGrid.Views.Grid.ViewInfo Imports DigitalData.Controls.LookupGrid Public Class frmFormDesigner @@ -171,7 +175,8 @@ Public Class frmFormDesigner Dim columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow) = findControlColumnsQuery.ToList() Dim table = ClassControlCreator.CreateExistingTable(row, columns, True) - AddHandler table.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick + AddHandler table.MouseClick, AddressOf gridControl_MouseClick + ' AddHandler table.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick pnldesigner.Controls.Add(table) SetMovementHandlers(table) @@ -296,17 +301,6 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(chk) - 'Case ClassControlCreator.PREFIX_DATAGRIDVIEW - ' Dim dgv = ClassControlCreator.CreateNewDatagridview(cursorPosition) - ' SetMovementHandlers(dgv) - - ' TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, dgv.Name, "DGV", dgv.Name, dgv.Location.X, dgv.Location.Y, Environment.UserName, dgv.Size.Height, dgv.Size.Width) - - ' CurrentControl = dgv - ' CurrentControl.Tag = GetLastID() - - ' pnldesigner.Controls.Add(dgv) - Case ClassControlCreator.PREFIX_DATAGRIDVIEW Dim lc As LookupControl = ClassControlCreator.CreateNewLookupControl(cursorPosition) @@ -323,7 +317,8 @@ Public Class frmFormDesigner Dim tb = ClassControlCreator.CreateNewTable(cursorPosition) SetMovementHandlers(tb) - AddHandler tb.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick + AddHandler tb.MouseClick, AddressOf gridControl_MouseClick + 'AddHandler tb.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, tb.Name, "TABLE", tb.Name, tb.Location.X, tb.Location.Y, Environment.UserName, tb.Size.Height, tb.Size.Width) @@ -334,7 +329,6 @@ Public Class frmFormDesigner TBPM_CONTROL_TABLETableAdapter.Insert(CurrentControl.Tag, "column2", "Column2", 95, Environment.UserName) pnldesigner.Controls.Add(tb) - Case ClassControlCreator.PREFIX_LINE Dim line = ClassControlCreator.CreateNewLine(cursorPosition) @@ -393,19 +387,53 @@ Public Class frmFormDesigner Next End Sub + Public Sub gridControl_MouseClick(sender As GridControl, e As MouseEventArgs) + Try + Dim oView As GridView = sender.DefaultView + Dim oHitinfo As GridHitInfo = oView.CalcHitInfo(sender.PointToClient(Cursor.Position)) + + CurrentControl = sender + CURRENT_CONTROL_ID = sender.Tag + + If oHitinfo.InColumn Then + Dim oColumn As GridColumn = oHitinfo.Column + + If oColumn Is Nothing Then + Exit Sub + End If + + Dim oColumnCaption As String = oColumn.Caption + Dim oColumnName As String = oColumn.FieldName + Dim oColumnId = TBPM_CONTROL_TABLETableAdapter.getColumnID(CURRENT_CONTROL_ID, oColumnName) + + Dim frmTableColumn = New frmControl_Detail() + frmTableColumn.FillData(oColumnId) + frmTableColumn.Text = "Konfiguration von Spalte: " & oColumnCaption + frmTableColumn.Show() + End If + Catch ex As Exception + MsgBox("Error while loading Column Configuration: " & vbCrLf & ex.Message, MsgBoxStyle.Critical) + End Try + End Sub + Public Sub table_ColumnHeaderMouseClick(sender As System.Object, e As DataGridViewCellMouseEventArgs) - CurrentControl = sender - Dim dgv As DataGridView = sender + Try + CurrentControl = sender + Dim dgv As DataGridView = sender - CurrentControl = dgv + CurrentControl = dgv + CURRENT_CONTROL_ID = dgv.Tag - Dim dgvColumn As DataGridViewColumn = dgv.Columns(e.ColumnIndex) - Dim columnId = TBPM_CONTROL_TABLETableAdapter.getColumnID(CURRENT_CONTROL_ID, dgvColumn.Name) - Dim frmTableColumn = New frmControl_Detail() + Dim dgvColumn As DataGridViewColumn = dgv.Columns(e.ColumnIndex) + Dim columnId = TBPM_CONTROL_TABLETableAdapter.getColumnID(CURRENT_CONTROL_ID, dgvColumn.Name) + Dim frmTableColumn = New frmControl_Detail() - frmTableColumn.FillData(columnId) - frmTableColumn.Text = "Konfiguration von Spalte: " & dgvColumn.Name - frmTableColumn.Show() + frmTableColumn.FillData(columnId) + frmTableColumn.Text = "Konfiguration von Spalte: " & dgvColumn.Name + frmTableColumn.Show() + Catch ex As Exception + MsgBox("Error while loading Column Configuration: " & vbCrLf & ex.Message, MsgBoxStyle.Critical) + End Try End Sub Sub DeleteControl(controlName As String) @@ -722,6 +750,12 @@ Public Class frmFormDesigner props = lookupProps + ElseIf TypeOf sender Is GridControl Then + Dim oGridControl As GridControl = sender + Dim oGridProps As GridControlProperties = CreatePropsObjectWithIndicies(New GridControlProperties, row, Windream_VectorIndicies) + oGridProps.AllowAddNewValues = StrToBool(row.Item("VKT_ADD_ITEM")) + + props = oGridProps Else MsgBox("This is not a supported control type!") Exit Sub diff --git a/app/DD_PM_WINDREAM/frmValidator.Designer.vb b/app/DD_PM_WINDREAM/frmValidator.Designer.vb index 9b64c2c..fdb5aad 100644 --- a/app/DD_PM_WINDREAM/frmValidator.Designer.vb +++ b/app/DD_PM_WINDREAM/frmValidator.Designer.vb @@ -36,6 +36,7 @@ Partial Class frmValidator Me.DateiÖffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateiInfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateieigenschaftenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.RefreshAdditionalSearchToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.TITLELabel1 = New System.Windows.Forms.Label() Me.btnSave = New System.Windows.Forms.Button() Me.DESCRIPTIONLabel = New System.Windows.Forms.Label() @@ -133,7 +134,6 @@ Partial Class frmValidator Me.ToolStripButtonJumpFile = New System.Windows.Forms.ToolStripButton() Me.ToolStripButtonDeleteFile = New System.Windows.Forms.ToolStripButton() Me.ToolStripButtonAnnotation = New System.Windows.Forms.ToolStripButton() - Me.RefreshAdditionalSearchToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() CType(Me.BarAndDockingController3, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.BarAndDockingController2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.BarAndDockingController1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -237,6 +237,11 @@ Partial Class frmValidator resources.ApplyResources(Me.DateieigenschaftenToolStripMenuItem, "DateieigenschaftenToolStripMenuItem") Me.DateieigenschaftenToolStripMenuItem.Name = "DateieigenschaftenToolStripMenuItem" ' + 'RefreshAdditionalSearchToolStripMenuItem + ' + Me.RefreshAdditionalSearchToolStripMenuItem.Name = "RefreshAdditionalSearchToolStripMenuItem" + resources.ApplyResources(Me.RefreshAdditionalSearchToolStripMenuItem, "RefreshAdditionalSearchToolStripMenuItem") + ' 'TITLELabel1 ' resources.ApplyResources(Me.TITLELabel1, "TITLELabel1") @@ -830,11 +835,6 @@ Partial Class frmValidator resources.ApplyResources(Me.ToolStripButtonAnnotation, "ToolStripButtonAnnotation") Me.ToolStripButtonAnnotation.Name = "ToolStripButtonAnnotation" ' - 'RefreshAdditionalSearchToolStripMenuItem - ' - Me.RefreshAdditionalSearchToolStripMenuItem.Name = "RefreshAdditionalSearchToolStripMenuItem" - resources.ApplyResources(Me.RefreshAdditionalSearchToolStripMenuItem, "RefreshAdditionalSearchToolStripMenuItem") - ' 'frmValidator ' resources.ApplyResources(Me, "$this") diff --git a/app/DD_PM_WINDREAM/frmValidator.resx b/app/DD_PM_WINDREAM/frmValidator.resx index b97cdc2..2a3817a 100644 --- a/app/DD_PM_WINDREAM/frmValidator.resx +++ b/app/DD_PM_WINDREAM/frmValidator.resx @@ -545,7 +545,7 @@ True - 197 + 170 7, 17 diff --git a/app/DD_PM_WINDREAM/frmValidator.vb b/app/DD_PM_WINDREAM/frmValidator.vb index 25ff070..04b4224 100644 --- a/app/DD_PM_WINDREAM/frmValidator.vb +++ b/app/DD_PM_WINDREAM/frmValidator.vb @@ -13,6 +13,7 @@ Imports System.ComponentModel Imports DD_LIB_Standards Imports DigitalData.Controls.LookupGrid Imports System.Data.SqlClient +Imports DevExpress.XtraGrid Public Class frmValidator Dim viewerID @@ -325,6 +326,8 @@ Public Class frmValidator _step = 3 TBDD_CONNECTIONTableAdapter.Fill(DD_DMSLiteDataSet.TBDD_CONNECTION) _step = 4 + TBPM_CONTROL_TABLETableAdapter.FillAll(DD_DMSLiteDataSet.TBPM_CONTROL_TABLE) + If LogErrorsOnly = False Then ClassLogger.Add(" >> Profile Data geladen", False) Catch ex As Exception MsgBox("Error LOADING profile-data(" & _step.ToString & "):" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:") @@ -514,100 +517,7 @@ Public Class frmValidator End Try End Sub - 'Sub ComboBoxData(profileId As Integer, controlName As String) - ' ' Informationen über Profil und Control holen - ' Dim ControlId As Integer = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(profileId, controlName) - ' Dim ConnectionId As Integer - ' Dim SQLCommand As String - - ' If ControlId = 0 Then - ' Exit Sub - ' End If - - ' ConnectionId = TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlId) - - ' If ConnectionId = 0 Then - ' Exit Sub - ' End If - - ' SQLCommand = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlId) - - ' If SQLCommand = String.Empty Then - ' Exit Sub - ' End If - - ' TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConnectionId) - - ' Dim connectionString As String - - ' For Each row As DataRow In DD_DMSLiteDataSet.TBDD_CONNECTION.Rows - ' Select Case row.Item("SQL_PROVIDER").ToString().ToLower() - ' Case "ms-sql" - ' If row.Item("USERNAME") = "WINAUTH" Then - ' connectionString = $"Data Source={row.Item("SERVER")};Initial Catalog=${row.Item("DATENBANK")};Trusted_Connection=True;" - ' Else - ' connectionString = $"Data Source={row.Item("SERVER")};Initial Catalog=${row.Item("DATENBANK")};User Id={row.Item("USERNAME")};Password={row.Item("PASSWORD")}" - ' End If - ' Case "oracle" - ' Dim csBuilder As New OracleConnectionStringBuilder() - - ' If row.Item("SERVER") <> String.Empty And Not IsDBNull(row.Item("SERVER")) Then - ' connectionString = $""" - ' Data Source=( - ' DESCRIPTION= - ' ADDRESS_LIST= - ' (ADDRESS= - ' (PROTOCOL=TCP) - ' (HOST={row.Item("SERVER")}) - ' (PORT=1521) - ' ) - ' ) - ' (CONNECT_DATA= - ' (SERVER=DEDICATED) - ' (SERVICE_NAME={row.Item("DATENBANK")}) - ' ) - ' ) - ' );User Id={row.Item("USERNAME")};Password={row.Item("PASSWORD")} - ' """ - ' Else - ' csBuilder.DataSource = row.Item("SERVER") - ' csBuilder.UserID = row.Item("USERNAME") - ' csBuilder.Password = row.Item("PASSWORD") - ' csBuilder.PersistSecurityInfo = True - ' csBuilder.ConnectionTimeout = 120 - - ' connectionString = csBuilder.ConnectionString - ' End If - ' Case Else - ' Exit Sub - ' End Select - ' Next - - ' Dim items As New List(Of String) - - ' Using adapter As New SqlClient.SqlDataAdapter() - ' Using conn As New SqlClient.SqlConnection(connectionString) - ' conn.Open() - - ' Using cmd As New SqlClient.SqlCommand(SQLCommand, conn) - - ' Dim dataSet As New DataSet() - - ' adapter.SelectCommand = cmd - ' adapter.Fill(dataSet) - ' Dim table = dataSet.Tables(0) - - ' For Each row As DataRow In table.Rows - ' items.Add(row.Item(0)) - ' Next - ' End Using - ' End Using - ' End Using - - - - 'End Sub Sub Load_Controls() Try @@ -2121,7 +2031,95 @@ Public Class frmValidator End If End If End If + Case "DevExpress.XtraGrid.GridControl" + oControlType = "DataGridView" + Dim dgv As GridControl = oControl + If oWMIndexName = "" Then + MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) + Exit For + End If + If oWMIndexName Is Nothing = False Then + If oLoadIndex = False Then + If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexwert soll nicht geladen werden.", False) + Exit Select + End If + If LogErrorsOnly = False Then ClassLogger.Add($" >> getting wmValue for Index {oWMIndexName}...", False) + Dim wertWD = aktivesDokument.GetVariableValue(oWMIndexName) + + If wertWD Is Nothing = False Then + 'Es wird gegen ein Vektorfeld nachindexiert + If wertWD.GetType.ToString.Contains("System.Object") Then + Select Case oTyp + 'Tabellendarstellung + Case "TABLE" + Dim dt As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = " & oControlId) + Dim SpaltenWerte As String() + If LogErrorsOnly = False Then ClassLogger.Add($" >> {dt.Rows.Count} Columns configured for control {oControlId}.", False) + If dt.Rows.Count > 1 Then + For Each Zeile As Object In wertWD + If LogErrorsOnly = False Then ClassLogger.Add($" >> vektorrow Value {Zeile.ToString}...", False) + SpaltenWerte = Split(Zeile, Delimiter) + Dim oDataSource As DataTable = dgv.DataSource + + Select Case dt.Rows.Count + Case 1 + oDataSource.Rows.Add(New String() {Zeile.ToString}) + 'dgv.Rows.Add(New String() {Zeile.ToString}) + Case 2 + If SpaltenWerte.Length = 2 Then + oDataSource.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1)}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1)}) + Else + oDataSource.Rows.Add(New String() {SpaltenWerte(0), ""}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), ""}) + End If + Case 3 + If SpaltenWerte.Length = 3 Then + oDataSource.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2)}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2)}) + ElseIf SpaltenWerte.Length = 2 Then + oDataSource.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), ""}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), ""}) + Else + oDataSource.Rows.Add(New String() {SpaltenWerte(0), "", ""}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), "", ""}) + End If + Case 4 + If SpaltenWerte.Length = 4 Then + oDataSource.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2), SpaltenWerte(3)}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2), SpaltenWerte(3)}) + ElseIf SpaltenWerte.Length = 3 Then + oDataSource.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2), ""}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2), ""}) + ElseIf SpaltenWerte.Length = 2 Then + oDataSource.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), "", ""}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), "", ""}) + Else + oDataSource.Rows.Add(New String() {SpaltenWerte(0), "", "", ""}) + 'dgv.Rows.Add(New String() {SpaltenWerte(0), "", "", ""}) + End If + + End Select + Next + End If + + Case Else + 'es handelt sich um ein einfaches Vektorfeld mit einem Wert + Dim oDataSource As DataTable = dgv.DataSource + For Each obj As Object In wertWD + If obj Is Nothing = False Then + oDataSource.Rows.Add(New String() {obj.ToString}) + 'dgv.Rows.Add(New String() {obj.ToString}) + End If + + Next + End Select + + + End If + End If + End If Case "System.Windows.Forms.CheckBox" If LogErrorsOnly = False Then ClassLogger.Add(" >> Loading checkbox.", False) oControlType = "CheckBox" @@ -3120,6 +3118,56 @@ Public Class frmValidator Exit For End If End If + + Case "DevExpress.XtraGrid.GridControl" + Dim dgv As GridControl = inctrl + + Dim Zeilen As Integer = dgv.DataSource.Rows.Count + + 'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss + If _MUSSEINGABE = True And Zeilen = 0 Then + missing = True + errmessage = "Missing input in vectorfield'" & dgv.Name & "'" + Exit For + ElseIf Zeilen > 0 Then + Dim ZeilenGrid As Integer = 0 + Dim myVektorArr As String() + 'Jeden Werte des Datagridviews durchlaufen + For Each row As DataRow In dgv.DataSource.Rows + Dim exists = False + Select Case Typ + Case "TABLE" + ' MsgBox(row.Cells(0).Value.GetType.ToString) + Dim str As String = String.Empty + If row.Item(0) <> String.Empty Then + 'Das Array anpassen + ReDim Preserve myVektorArr(ZeilenGrid) + + str = String.Join(Delimiter, row.ItemArray) + + 'Den Wert im Array speichern + myVektorArr(ZeilenGrid) = str + ZeilenGrid += 1 + End If + Case Else + ' MsgBox(row.Cells(0).Value.GetType.ToString) + If row.Item(0) Is Nothing = False Then + 'Das Array anpassen + ReDim Preserve myVektorArr(ZeilenGrid) + 'Den Wert im Array speichern + myVektorArr(ZeilenGrid) = row.Item(0).Value.ToString + ZeilenGrid += 1 + End If + End Select + + Next + 'Jetzt die Datei indexieren + If Indexiere_File(aktivesDokument, _IDXName, myVektorArr) = False Then + missing = True + errmessage = "Fehler beim Indexieren Vektorfeld - ERROR: " & idxerr_message + Exit For + End If + End If End Select End If 'End If für Control und ReadOnly = False Next