From 46d2a9109b7667f3d0bdfa13a95ed76b14496a83 Mon Sep 17 00:00:00 2001 From: Developer01 Date: Mon, 10 Aug 2026 14:24:19 +0200 Subject: [PATCH] Verbesserung der Label-Erstellung und Fehlerbehandlung MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die Erstellung neuer Labels in `frmFormDesigner.vb` wurde überarbeitet: - Verwendung eines SQL-Insert-Statements anstelle der Methode `cmdInsertAnlage`. - Hinzufügen einer Fehlerbehandlung mit Log-Nachricht und `MsgBox` bei fehlgeschlagenem Insert. - Aktivierung der Label-Eigenschaften nur bei erfolgreichem Insert. - Erweiterung der allgemeinen Fehlerbehandlung mit einer Benutzerbenachrichtigung. In `frmValidator.vb` wurden folgende Änderungen vorgenommen: - Zurücksetzen des Textes eines `ComboBox`-Steuerelements auf einen leeren String. - Korrektur der Berechnung der verbleibenden Vorgänge (`Amount_Docs2Validate`), um den Zähler korrekt anzuzeigen. --- app/TaskFlow/frmFormDesigner.vb | 27 +++++++++++++++++---------- app/TaskFlow/frmValidator.vb | 3 ++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/app/TaskFlow/frmFormDesigner.vb b/app/TaskFlow/frmFormDesigner.vb index 4477283..140cd55 100644 --- a/app/TaskFlow/frmFormDesigner.vb +++ b/app/TaskFlow/frmFormDesigner.vb @@ -1163,15 +1163,22 @@ Public Class frmFormDesigner Dim label = ControlCreator.CreateNewLabel(cursorPosition) SetMovementHandlers(label) - TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, label.Name, "LBL", label.Text, label.Location.X, label.Location.Y, USER_USERNAME, label.Size.Height, label.Size.Width, label.TextAlign) - CHANGES_FORM_DESIGN = True - CurrentControl = label - CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With { - .Guid = GetLastID(), - .ReadOnly = False - } - - pnldesigner.Controls.Add(label) + Dim oInsert = $"INSERT INTO TBPM_PROFILE_CONTROLS + (PROFIL_ID, NAME, CTRL_TYPE, CTRL_TEXT, X_LOC, Y_LOC, ADDED_WHO, HEIGHT, WIDTH, TEXT_ALIGNMENT, DISPLAY_IN_SEPERATE_FORM) + VALUES ({ProfileId},'{label.Name}','LBL','{label.Text}','{label.Location.X}','{label.Location.Y}','{USER_USERNAME}',{label.Size.Height},{label.Size.Width},'{label.TextAlign}','')" + If DatabaseFallback.ExecuteNonQueryECM(oInsert) Then + 'TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, label.Name, "LBL", label.Text, label.Location.X, label.Location.Y, USER_USERNAME, label.Size.Height, label.Size.Width, label.TextAlign, "") + CHANGES_FORM_DESIGN = True + CurrentControl = label + CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With { + .Guid = GetLastID(), + .ReadOnly = False + } + pnldesigner.Controls.Add(label) + Else + _Logger.Info($"Error while inserting new Label Control into TBPM_PROFILE_CONTROLS: {oInsert}") + MsgBox("Fehler beim Erstellen des Labels. Bitte überprüfen Sie die Log-Datei für weitere Informationen.", MsgBoxStyle.Critical, "Fehler beim Erstellen des Labels") + End If Case ClassControlCreator.PREFIX_TEXTBOX Dim txt = ControlCreator.CreateNewTextBox(cursorPosition) @@ -1304,9 +1311,9 @@ Public Class frmFormDesigner RibPGCtrlWidth.Enabled = True End If Catch ex As Exception - _Logger.Error(ex) _Logger.Info($"Error while Adding new control {NewControlSelected}:") _Logger.Info(ex) + MsgBox($"Error while Adding new control {NewControlSelected}: {ex.Message}" & vbCrLf & "Check the log for further info", MsgBoxStyle.Critical) End Try Me.Cursor = Cursors.Default NewControlSelected = "" diff --git a/app/TaskFlow/frmValidator.vb b/app/TaskFlow/frmValidator.vb index 66a676f..92c9a99 100644 --- a/app/TaskFlow/frmValidator.vb +++ b/app/TaskFlow/frmValidator.vb @@ -1775,6 +1775,7 @@ Public Class frmValidator Case Type = GetType(Windows.Forms.ComboBox) Dim cmb As Windows.Forms.ComboBox = inctrl cmb.SelectedIndex = -1 + cmb.Text = String.Empty Case Type = GetType(DataGridView) Dim dgv As DataGridView = inctrl If dgv.Rows.Count > 0 Then @@ -4148,7 +4149,7 @@ Public Class frmValidator End If If Amount_Docs2Validate > 1 Then - Dim omsg = String.Format(Translation_Strings.Verbleibende_Vorgänge___0_, Amount_Docs2Validate) + Dim omsg = String.Format(Translation_Strings.Verbleibende_Vorgänge___0_, Amount_Docs2Validate - 1) bsiInformation.Caption = omsg bsiInformation.Caption = omsg If RbnPgGrpActions.Visible = False Then