Replace old stinky Table with fancy GridControl

This commit is contained in:
Jonathan Jenne 2019-04-11 15:48:12 +02:00
parent 93716bcc96
commit 8dadf1ff30
6 changed files with 259 additions and 159 deletions

View File

@ -1,4 +1,7 @@
Imports DD_LIB_Standards Imports DD_LIB_Standards
Imports DevExpress.Utils
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DigitalData.Controls.LookupGrid Imports DigitalData.Controls.LookupGrid
Public Class ClassControlCreator Public Class ClassControlCreator
@ -25,6 +28,7 @@ Public Class ClassControlCreator
Public Const PREFIX_TABLE = "TB" Public Const PREFIX_TABLE = "TB"
Public Const PREFIX_LINE = "LINE" Public Const PREFIX_LINE = "LINE"
''' <summary> ''' <summary>
''' Standard Eigenschaften für alle Controls ''' Standard Eigenschaften für alle Controls
''' </summary> ''' </summary>
@ -168,30 +172,22 @@ Public Class ClassControlCreator
Return control Return control
End Function End Function
Public Shared Function CreateNewTable(location As Point) As GridControl
Public Shared Function CreateNewTable(location As Point) As DataGridView Dim oControl As New GridControl With {
Dim control As New DataGridView With {
.Name = $"{PREFIX_TABLE}_{clsTools.ShortGuid}", .Name = $"{PREFIX_TABLE}_{clsTools.ShortGuid}",
.Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT_TABLE), .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT_TABLE),
.Cursor = Cursors.Hand, .Cursor = Cursors.Hand,
.Location = location, .Location = location
.AllowUserToAddRows = False,
.AllowUserToDeleteRows = False,
.AllowUserToResizeColumns = False,
.AllowUserToResizeRows = False
} }
Dim oView As GridView = oControl.DefaultView
oView.OptionsView.ShowGroupPanel = False
control.Columns.Add(New DataGridViewTextBoxColumn With { Dim oDatatable As New DataTable()
.HeaderText = "Column1", oDatatable.Columns.Add("column1", GetType(String))
.Name = "column1" oDatatable.Columns.Add("column2", GetType(String))
}) oControl.DataSource = oDatatable
control.Columns.Add(New DataGridViewTextBoxColumn With { Return oControl
.HeaderText = "Column2",
.Name = "column2"
})
Return control
End Function End Function
Public Shared Function CreateNewLine(location As Point) As LineLabel Public Shared Function CreateNewLine(location As Point) As LineLabel
@ -319,31 +315,46 @@ Public Class ClassControlCreator
Return control Return control
End Function End Function
Public Shared Function CreateExistingTable(row As DataRow, columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow), designMode As Boolean) As DataGridView Public Shared Function CreateExistingTable(row As DataRow, columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow), designMode As Boolean) As GridControl
Dim control As DataGridView = CreateBaseControl(New DataGridView(), row, designMode) 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) oControl.ForceInitialize()
Next
oView = oControl.DefaultView
oView.OptionsView.ShowGroupPanel = False
If Not designMode Then If Not designMode Then
control.Enabled = Not row.Item("READ_ONLY") oView.OptionsBehavior.Editable = Not row.Item("READ_ONLY")
control.TabStop = 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 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 End Function
Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel

View File

@ -314,6 +314,13 @@ Public Module ModuleControlProperties
Inherits InputProperties Inherits InputProperties
End Class End Class
Public Class GridControlProperties
Inherits InputProperties
<Category("Einstellungen")>
Public Property AllowAddNewValues As Boolean
End Class
Public Class LookupControlProperties Public Class LookupControlProperties
Inherits InputProperties Inherits InputProperties

View File

@ -1,5 +1,9 @@
Imports System.ComponentModel Imports System.ComponentModel
Imports DD_LIB_Standards 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 Imports DigitalData.Controls.LookupGrid
Public Class frmFormDesigner Public Class frmFormDesigner
@ -171,7 +175,8 @@ Public Class frmFormDesigner
Dim columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow) = findControlColumnsQuery.ToList() Dim columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow) = findControlColumnsQuery.ToList()
Dim table = ClassControlCreator.CreateExistingTable(row, columns, True) 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) pnldesigner.Controls.Add(table)
SetMovementHandlers(table) SetMovementHandlers(table)
@ -296,17 +301,6 @@ Public Class frmFormDesigner
pnldesigner.Controls.Add(chk) 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 Case ClassControlCreator.PREFIX_DATAGRIDVIEW
Dim lc As LookupControl = ClassControlCreator.CreateNewLookupControl(cursorPosition) Dim lc As LookupControl = ClassControlCreator.CreateNewLookupControl(cursorPosition)
@ -323,7 +317,8 @@ Public Class frmFormDesigner
Dim tb = ClassControlCreator.CreateNewTable(cursorPosition) Dim tb = ClassControlCreator.CreateNewTable(cursorPosition)
SetMovementHandlers(tb) 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) 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) TBPM_CONTROL_TABLETableAdapter.Insert(CurrentControl.Tag, "column2", "Column2", 95, Environment.UserName)
pnldesigner.Controls.Add(tb) pnldesigner.Controls.Add(tb)
Case ClassControlCreator.PREFIX_LINE Case ClassControlCreator.PREFIX_LINE
Dim line = ClassControlCreator.CreateNewLine(cursorPosition) Dim line = ClassControlCreator.CreateNewLine(cursorPosition)
@ -393,19 +387,53 @@ Public Class frmFormDesigner
Next Next
End Sub 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) Public Sub table_ColumnHeaderMouseClick(sender As System.Object, e As DataGridViewCellMouseEventArgs)
CurrentControl = sender Try
Dim dgv As DataGridView = sender 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 dgvColumn As DataGridViewColumn = dgv.Columns(e.ColumnIndex)
Dim columnId = TBPM_CONTROL_TABLETableAdapter.getColumnID(CURRENT_CONTROL_ID, dgvColumn.Name) Dim columnId = TBPM_CONTROL_TABLETableAdapter.getColumnID(CURRENT_CONTROL_ID, dgvColumn.Name)
Dim frmTableColumn = New frmControl_Detail() Dim frmTableColumn = New frmControl_Detail()
frmTableColumn.FillData(columnId) frmTableColumn.FillData(columnId)
frmTableColumn.Text = "Konfiguration von Spalte: " & dgvColumn.Name frmTableColumn.Text = "Konfiguration von Spalte: " & dgvColumn.Name
frmTableColumn.Show() frmTableColumn.Show()
Catch ex As Exception
MsgBox("Error while loading Column Configuration: " & vbCrLf & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub End Sub
Sub DeleteControl(controlName As String) Sub DeleteControl(controlName As String)
@ -722,6 +750,12 @@ Public Class frmFormDesigner
props = lookupProps 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 Else
MsgBox("This is not a supported control type!") MsgBox("This is not a supported control type!")
Exit Sub Exit Sub

View File

@ -36,6 +36,7 @@ Partial Class frmValidator
Me.DateiÖffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateiÖffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DateiInfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateiInfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DateieigenschaftenToolStripMenuItem = 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.TITLELabel1 = New System.Windows.Forms.Label()
Me.btnSave = New System.Windows.Forms.Button() Me.btnSave = New System.Windows.Forms.Button()
Me.DESCRIPTIONLabel = New System.Windows.Forms.Label() Me.DESCRIPTIONLabel = New System.Windows.Forms.Label()
@ -133,7 +134,6 @@ Partial Class frmValidator
Me.ToolStripButtonJumpFile = New System.Windows.Forms.ToolStripButton() Me.ToolStripButtonJumpFile = New System.Windows.Forms.ToolStripButton()
Me.ToolStripButtonDeleteFile = New System.Windows.Forms.ToolStripButton() Me.ToolStripButtonDeleteFile = New System.Windows.Forms.ToolStripButton()
Me.ToolStripButtonAnnotation = 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.BarAndDockingController3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BarAndDockingController2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.BarAndDockingController2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BarAndDockingController1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.BarAndDockingController1, System.ComponentModel.ISupportInitialize).BeginInit()
@ -237,6 +237,11 @@ Partial Class frmValidator
resources.ApplyResources(Me.DateieigenschaftenToolStripMenuItem, "DateieigenschaftenToolStripMenuItem") resources.ApplyResources(Me.DateieigenschaftenToolStripMenuItem, "DateieigenschaftenToolStripMenuItem")
Me.DateieigenschaftenToolStripMenuItem.Name = "DateieigenschaftenToolStripMenuItem" Me.DateieigenschaftenToolStripMenuItem.Name = "DateieigenschaftenToolStripMenuItem"
' '
'RefreshAdditionalSearchToolStripMenuItem
'
Me.RefreshAdditionalSearchToolStripMenuItem.Name = "RefreshAdditionalSearchToolStripMenuItem"
resources.ApplyResources(Me.RefreshAdditionalSearchToolStripMenuItem, "RefreshAdditionalSearchToolStripMenuItem")
'
'TITLELabel1 'TITLELabel1
' '
resources.ApplyResources(Me.TITLELabel1, "TITLELabel1") resources.ApplyResources(Me.TITLELabel1, "TITLELabel1")
@ -830,11 +835,6 @@ Partial Class frmValidator
resources.ApplyResources(Me.ToolStripButtonAnnotation, "ToolStripButtonAnnotation") resources.ApplyResources(Me.ToolStripButtonAnnotation, "ToolStripButtonAnnotation")
Me.ToolStripButtonAnnotation.Name = "ToolStripButtonAnnotation" Me.ToolStripButtonAnnotation.Name = "ToolStripButtonAnnotation"
' '
'RefreshAdditionalSearchToolStripMenuItem
'
Me.RefreshAdditionalSearchToolStripMenuItem.Name = "RefreshAdditionalSearchToolStripMenuItem"
resources.ApplyResources(Me.RefreshAdditionalSearchToolStripMenuItem, "RefreshAdditionalSearchToolStripMenuItem")
'
'frmValidator 'frmValidator
' '
resources.ApplyResources(Me, "$this") resources.ApplyResources(Me, "$this")

View File

@ -545,7 +545,7 @@
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>197</value> <value>170</value>
</metadata> </metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing"> <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>7, 17</value> <value>7, 17</value>

View File

@ -13,6 +13,7 @@ Imports System.ComponentModel
Imports DD_LIB_Standards Imports DD_LIB_Standards
Imports DigitalData.Controls.LookupGrid Imports DigitalData.Controls.LookupGrid
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports DevExpress.XtraGrid
Public Class frmValidator Public Class frmValidator
Dim viewerID Dim viewerID
@ -325,6 +326,8 @@ Public Class frmValidator
_step = 3 _step = 3
TBDD_CONNECTIONTableAdapter.Fill(DD_DMSLiteDataSet.TBDD_CONNECTION) TBDD_CONNECTIONTableAdapter.Fill(DD_DMSLiteDataSet.TBDD_CONNECTION)
_step = 4 _step = 4
TBPM_CONTROL_TABLETableAdapter.FillAll(DD_DMSLiteDataSet.TBPM_CONTROL_TABLE)
If LogErrorsOnly = False Then ClassLogger.Add(" >> Profile Data geladen", False) If LogErrorsOnly = False Then ClassLogger.Add(" >> Profile Data geladen", False)
Catch ex As Exception Catch ex As Exception
MsgBox("Error LOADING profile-data(" & _step.ToString & "):" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:") MsgBox("Error LOADING profile-data(" & _step.ToString & "):" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
@ -514,100 +517,7 @@ Public Class frmValidator
End Try End Try
End Sub 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() Sub Load_Controls()
Try Try
@ -2121,7 +2031,95 @@ Public Class frmValidator
End If End If
End If 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" Case "System.Windows.Forms.CheckBox"
If LogErrorsOnly = False Then ClassLogger.Add(" >> Loading checkbox.", False) If LogErrorsOnly = False Then ClassLogger.Add(" >> Loading checkbox.", False)
oControlType = "CheckBox" oControlType = "CheckBox"
@ -3120,6 +3118,56 @@ Public Class frmValidator
Exit For Exit For
End If End If
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 Select
End If 'End If für Control und ReadOnly = False End If 'End If für Control und ReadOnly = False
Next Next