Fehlerhandling verbessert -> falsche von Nutzer eingegebene Werte werden in div. Spalten geprüft/entfernt.

This commit is contained in:
2022-11-23 11:45:14 +01:00
parent 51f2e33a10
commit c999394224
2 changed files with 30 additions and 9 deletions

View File

@@ -113,11 +113,13 @@ Public Class frmGesamtsicherheitenMenuNEU
For Each row As DataGridViewRow In dgvListe.Rows
If row.Cells("gs_SicherheitsSaldo").Value <> 0 Then
If Not IsDBNull(row.Cells("gs_SicherheitsSaldo").Value) Then
If row.Cells("gs_SicherheitsSaldo").Value <> 0 Then
dataTable.Rows.Add(row.Cells("gs_gsnr").Value, True)
Else
dataTable.Rows.Add(row.Cells("gs_gsnr").Value, False)
dataTable.Rows.Add(row.Cells("gs_gsnr").Value, True)
Else
dataTable.Rows.Add(row.Cells("gs_gsnr").Value, False)
End If
End If
Next
@@ -130,11 +132,12 @@ Public Class frmGesamtsicherheitenMenuNEU
For Each row As DataGridViewRow In dgvListe.Rows
If row.Cells("gs_SicherheitsSaldo").Value <> 0 Then
row.DefaultCellStyle.BackColor = Color.Red
Else
row.DefaultCellStyle.BackColor = Color.Green
If Not IsDBNull(row.Cells("gs_SicherheitsSaldo").Value) Then
If row.Cells("gs_SicherheitsSaldo").Value <> 0 Then
row.DefaultCellStyle.BackColor = Color.Red
Else
row.DefaultCellStyle.BackColor = Color.Green
End If
End If
Next

View File

@@ -344,6 +344,8 @@ Public Class frmGesamtsicherheitenNEU
Private Sub Warenwert_TextChanged(sender As Object, e As EventArgs) Handles txtSicherheitWarenwert.TextChanged, txtPosWarenwert.TextChanged
If Not IsNumeric(txtSicherheitWarenwert.Text) And sender.name = "txtSicherheitWarenwert" Then
txtSicherheitWarenwert.ForeColor = Color.Red
Exit Sub
@@ -361,6 +363,11 @@ Public Class frmGesamtsicherheitenNEU
End If
txtSicherheitWarenwert.Text = Replace(txtSicherheitWarenwert.Text, ".", "")
txtPosWarenwert.Text = Replace(txtPosWarenwert.Text, ".", "")
txtSicherheitWarenwert.Text = Replace(txtSicherheitWarenwert.Text, "", "")
txtPosWarenwert.Text = Replace(txtPosWarenwert.Text, "", "")
Try
Select Case sender.name
Case "txtSicherheitWarenwert"
@@ -1332,4 +1339,15 @@ Public Class frmGesamtsicherheitenNEU
dgvSicherheitsPos.Enabled = True
End Sub
Private Sub txtAbfertNum_TextChanged(sender As Object, e As EventArgs) Handles txtAbfertNum.TextChanged
If Not IsNumeric(txtAbfertNum.Text) Then
txtAbfertNum.ForeColor = Color.Red
btnSave.Enabled = False
Exit Sub
Else
txtAbfertNum.ForeColor = Color.Black
btnSave.Enabled = True
End If
End Sub
End Class