I'm trying to check a string for invalid characters. The valid characters are 0 to 9 and + and ,
My program goes out with errors. No explanation.
Who can help ?
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim W_Breite_mehrere As TextField
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
W_Breite_mehrere.Initialize("")
W_Breite_mehrere.Text = "1.2a2,2+3"
'Alle Eingabefelder auf ungültige Zeichen überprüfen
W_Breite_mehrere.Text = W_Breite_mehrere.Text.Replace(".", ",")
For i = 0 To W_Breite_mehrere.Text.Trim.Length - 1
Log(W_Breite_mehrere.Text.Trim.SubString2(i, i+1))
If W_Breite_mehrere.Text.Trim.SubString2(i, i+1) = "+" Or W_Breite_mehrere.Text.Trim.SubString2(i, i+1) = "," Or (W_Breite_mehrere.Text.Trim.SubString2(i, i+1) >= "0" And W_Breite_mehrere.Text.Trim.SubString2(i, i+1) <= "9") Then
'Alles OK
Else
fx.msgbox(Null,"Die Angaben im Feld mehrere Breiten enthalten ungültige Zeichen !!!" , "Programm-Hinweis")
End If
Next
W_Breite_mehrere.Text = W_Breite_mehrere.Text.Replace(",", ".")
End Sub
My program goes out with errors. No explanation.
Who can help ?
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim W_Breite_mehrere As TextField
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
W_Breite_mehrere.Initialize("")
W_Breite_mehrere.Text = "1.2a2,2+3"
'Alle Eingabefelder auf ungültige Zeichen überprüfen
W_Breite_mehrere.Text = W_Breite_mehrere.Text.Replace(".", ",")
For i = 0 To W_Breite_mehrere.Text.Trim.Length - 1
Log(W_Breite_mehrere.Text.Trim.SubString2(i, i+1))
If W_Breite_mehrere.Text.Trim.SubString2(i, i+1) = "+" Or W_Breite_mehrere.Text.Trim.SubString2(i, i+1) = "," Or (W_Breite_mehrere.Text.Trim.SubString2(i, i+1) >= "0" And W_Breite_mehrere.Text.Trim.SubString2(i, i+1) <= "9") Then
'Alles OK
Else
fx.msgbox(Null,"Die Angaben im Feld mehrere Breiten enthalten ungültige Zeichen !!!" , "Programm-Hinweis")
End If
Next
W_Breite_mehrere.Text = W_Breite_mehrere.Text.Replace(",", ".")
End Sub
Attachments
Last edited: