My problem:
When my text box's MaxLength
is reached, a beep sound is produced. I want to prevent this beeping and would even go so far as preventing all instances of beeping for my application if achievable.
I'm already familiar with how to mimic MaxLength
using Substring
and resetting the caret but in this particular instance, substituting MaxLength
is not an option.
To reproduce:
- In Visual Studio, in design mode, drag a text box onto a fresh form.
- Use the following as is:
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TextBox1.MaxLength = 5
End Sub
Private Sub TextBox1_keypress(keyascii As Integer)
If len(TextBox1.text) = 5 Then
keyascii = 0
End If
End Sub
End Class
The above is an adaptation of examples I've come across online but has no effect.
Test this: