Public Class frmPreisText Sub New(TextVorlage As String) InitializeComponent() Me.txtLeistung.Text = TextVorlage.replace(".", "").Replace("……", "") End Sub Private Sub txt_KeyDown(sender As Object, e As KeyEventArgs) Handles txt.KeyDown, txtLeistung.KeyDown If e.KeyCode = Keys.Return Then btnOK.PerformClick() End If If e.KeyCode = Keys.Escape Then FlatButton1.PerformClick() End If End Sub Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click If txtLeistung.Text = "" Or Not IsNumeric(txt.Text) Or txtLeistung.Text.Length > 30 Then Me.DialogResult = Windows.Forms.DialogResult.None End If End Sub Private Sub frmPreisText_Shown(sender As Object, e As EventArgs) Handles Me.Shown txtLeistung.Focus() txtLeistung.Select(txtLeistung.Text.Length, 0) End Sub End Class