Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

c# trotzkeypress handler kommt noch falsche zahl //letzten char aus textbox entfernen

Empfohlene Antworten

Veröffentlicht

hi habe das problem das ich etwas in eine textbox eingeben möchte dies aber nur zahlen (keine negativen) sein sollen und nach 13 zeichen (in meinem fall zahlen) es in einen string speichern möchte und sobald eine korrekte 14zahl kommt dies in die gleiche textbox schreibt die ersten 13 aber wieder löscht.

wie mache ich das? habe schon etwas aber ka ob das eine elegante lösung ist, hierbei ist das problem das er zwar "schreit" wenn ich etwas anderes als eine zahl eingebe aber dann noch die zahl in die box schreibt obwohl er sie erkennt

folgend: erst kontrolle bei keypress in der textbox ob es eine zahl ist und dann wenn 13 zeichen in der box stehn in den string speichert, geht dies vereinfacht bzw zusammen in einem?

danke für die hilfe im vorhinein mfg didi

//zahl ja nein?

private void textBoxReaderIncome_KeyPress(object sender, KeyPressEventArgs e)

{

if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar))

MessageBox.Show("NUR ZAHLEN!");

}

//bei 13 zeichen in strReaderIncome speichern

private void textBox1_TextChanged(object sender, EventArgs e)

{

for (; ; )

{

if (textBoxReaderIncome.Text.Length == 13)

{

strReaderIncome = textBoxReaderIncome.Text;

}

break;

}

}

:byby:

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.