Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
HTML IntelliSense 1.5 - CreateNameDialog.vb

CreateNameDialog.vb

Caricato da: Totem
Scarica il programma completo

  1. Imports System.Windows.Forms
  2.  
  3. Public Class CreateNameDialog
  4.     Public ReadOnly Property CreatedName() As String
  5.         Get
  6.             Return txtName.Text
  7.         End Get
  8.     End Property
  9.  
  10.     Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
  11.         Me.DialogResult = System.Windows.Forms.DialogResult.OK
  12.         Me.Close()
  13.     End Sub
  14.  
  15.     Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
  16.         Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
  17.         Me.Close()
  18.     End Sub
  19.  
  20.     Private Sub CreateNameDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  21.         txtName.Focus()
  22.     End Sub
  23.  
  24.     Private Sub txtName_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtName.KeyDown
  25.         If Not (Char.IsDigit(Chr(e.KeyValue)) Or Char.IsLetter(Chr(e.KeyValue)) Or e.KeyCode = Keys.Back) Then
  26.             e.SuppressKeyPress = True
  27.             e.Handled = True
  28.         Else
  29.             If (e.Alt Or e.Control Or e.Shift) Then
  30.                 e.SuppressKeyPress = True
  31.                 e.Handled = True
  32.             End If
  33.         End If
  34.     End Sub
  35. End Class