JJ 21.04.16

This commit is contained in:
JenneJ 2016-04-21 17:37:34 +02:00
parent b13468f42c
commit 012b5d20db
4 changed files with 35 additions and 17 deletions

View File

@ -148,16 +148,22 @@ Public Class ClassControlBuilder
Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId)
Dim value
Select Case control.GetType()
Case GetType(CustomComboBox)
If IsNothing(DirectCast(control, CustomComboBox).ValueMember) Then
' Diese Befehle führen dazu, dass auch der ValueMember als Wert ausgelesen wird
' Das kann zu unerwarteten Ergebnissen führen, da der Benutzer nur den DisplayMember sieht.
'Select Case control.GetType()
' Case GetType(CustomComboBox)
' If IsNothing(DirectCast(control, CustomComboBox).ValueMember) Then
' value = DirectCast(control, CustomComboBox).Text
' Else
' value = DirectCast(control, CustomComboBox).SelectedValue
' End If
' Case Else
' Exit Sub
'End Select
' Die bessere Lösung ist für jetzt, einfach den angezeigten Wert auszulesen:
value = DirectCast(control, CustomComboBox).Text
Else
value = DirectCast(control, CustomComboBox).SelectedValue
End If
Case Else
Exit Sub
End Select
If String.IsNullOrEmpty(value) Then
Exit Sub
@ -191,9 +197,8 @@ Public Class ClassControlBuilder
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
If LogErrorsOnly = False Then ClassLogger.Add(" >> " & String.Format("Executing SQL_COMMAND: '{0}' for controlID '{1}'", sqlcommand, dependingControlId))
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
Dim obj
obj = dependingControl.GetType.ToString
Select Case dependingControl.GetType().Name
Dim type = dependingControl.GetType().Name
Select Case type
Case "CustomComboBox"
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, CustomComboBox), dt)

View File

@ -479,7 +479,16 @@ Public Class ClassControlValues
Case GetType(DataGridView)
Dim dgv As DataGridView = DirectCast(control, DataGridView)
Dim ds = dgv.DataSource
If (IsNothing(ds)) Then
dgv.Rows.Clear()
dgv.Refresh()
Else
dgv.DataSource = Nothing
dgv.Refresh()
End If
Console.WriteLine("Clearing DataGridView")
End Select
End Sub
@ -488,7 +497,7 @@ Public Class ClassControlValues
#Region "LoadDefaultValue"
Public Shared Sub LoadDefaultValues(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection)
'' Zuerst alle Controls leeren
'ClearControlValues(controls)
ClearControlValues(controls)
Dim i = 0
For Each control As Control In controls

View File

@ -24,13 +24,14 @@
If e.Index >= 0 Then
Dim label As String
' Wenn die Items eine Static List ist, wird der String ausgelesen
If (Me.Items(e.Index).GetType() = GetType(String)) Then
label = Me.Items(e.Index).ToString()
Else
'Wenn die Items aus einer Datatable kommen, wird der DisplayMember ausgelesen
Dim rowView As DataRowView = Me.Items(e.Index)
Dim rowCount As Integer = rowView.Row.ItemArray.Count
If rowCount = 1 Then
label = rowView.Item(0)
ElseIf rowCount = 2 Then

View File

@ -720,7 +720,8 @@ Public Class frmConstructor_Main
RIGHT_ONLY_READ = False
End Try
If RIGHT_ONLY_READ = True Then
tsButtonAdd.Enabled = False
' Hinzufügen sollte auch bei RIGHT_ONLY_READ verfügbar sein
tsButtonAdd.Enabled = True
tsButtonEdit.Enabled = False
tsButtonSave.Enabled = False
tsButtonDelete.Enabled = False
@ -1155,6 +1156,8 @@ Public Class frmConstructor_Main
ClassControlValues.LoadDefaultValues(ENTITY_ID, SELECTED_RECORD_ID, pnlDetails.Controls)
' Im gegensatz zu EnableEditMode muss hier nur der save button enabled werden
tsButtonSave.Enabled = True
' Muss aktiviert werden, sonst funktionieren die Combobox Abhängigkeits Events nicht
CURRENT_RECORD_ENABLED = True
EDIT_STATE = EditState.Insert
RECORD_CHANGED = True
tsslblRecord.Text = "Adding record ......"