Private Sub TextField1_TextChanged (Old As String, NewText As String)
If NewText.Length<1 Then
TextField1.TextColor = Colors.Blue
Return
End If
If NewText.Length>7 Then 'Size Max to Textfield1
CallSubDelayed3(Me, "CutText", TextField1, 7) 'Size Max to Textfield1
Else
TextField1.TextColor = Colors.Blue
Dim Mask As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 'allowed characters
Dim Textlist As List
Textlist.Initialize
Textlist.Clear
For m = 0 To NewText.Length - 1
For n=0 To Mask.Length - 1
If NewText.SubString2(m,m+1)=Mask.SubString2(n,n+1) Then
Textlist.Add(NewText.SubString2(0,m+1))
End If
Next
Next
If Textlist.Size <> NewText.Length Then
TextField1.TextColor = Colors.Red
If NewText.Length>=Old.Length Then
Dim PD1 As HUD
PD1.ToastMessageShow("Not allowed character",False)
End If
End If
End If
End Sub
Sub CutText(Tf As TextField, MaxLength As Int)
Tf.ResignFocus
Tf.Text = Tf.Text.SubString2(0,MaxLength)
Tf.RequestFocus
End Sub