Private Sub EncryptionKey_Validating(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EncryptionKey.Validating If EncryptionKey.TextLength < 8 Then MessageBox.Show("The length of the encryption key should be at least 8 characters", _ "Mitchell CCS Monitor", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If End SubBut, this gives the error: