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
Convert to ascii or char - Form1.vb

Form1.vb

Caricato da: Albertking82
Scarica il programma completo

  1. Public Class Form1
  2.     Sub clear()
  3.         txtasc.Text = ""
  4.         txtasc.Focus()
  5.         cmddel.Enabled = False
  6.     End Sub
  7.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  8.         Dim ascii As Int16, car As String, num As Int16
  9.         If txtasc.Text <> "" Then
  10.             If mnuasc.Checked = True Then
  11.                 txtasc.MaxLength = 1
  12.                 ascii = Asc(txtasc.Text)
  13.                 txtasc.Text = ascii
  14.                 Button1.Enabled = False
  15.             Else
  16.                 If Not IsNumeric(txtasc.Text) Then
  17.                     MsgBox("Char code error", MsgBoxStyle.Critical, "Error")
  18.                     Call clear()
  19.                     Exit Sub
  20.                 End If
  21.                 num = CInt(txtasc.Text)
  22.                 If num > 31 And num < 255 Then
  23.                     car = Chr(txtasc.Text)
  24.                     txtasc.Text = car
  25.                     Button1.Enabled = False
  26.                 Else
  27.                     MsgBox("Char code error", MsgBoxStyle.Critical, "Error")
  28.                     Call clear()
  29.                     Exit Sub
  30.                 End If
  31.             End If
  32.  
  33.         Else
  34.             txtasc.Focus()
  35.         End If
  36.     End Sub
  37.  
  38.     Public Sub New()
  39.  
  40.         ' This call is required by the Windows Form Designer.
  41.         InitializeComponent()
  42.  
  43.         ' Add any initialization after the InitializeComponent() call.
  44.  
  45.     End Sub
  46.  
  47.     Protected Overrides Sub Finalize()
  48.         MyBase.Finalize()
  49.  
  50.     End Sub
  51.  
  52.     Private Sub cmddel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddel.Click
  53.         If txtasc.Text <> "" Then
  54.             txtasc.Text = ""
  55.             txtasc.Focus()
  56.             cmddel.Enabled = False
  57.         End If
  58.         Button1.Enabled = True
  59.     End Sub
  60.  
  61.     Private Sub txtasc_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtasc.TextChanged
  62.         cmddel.Enabled = True
  63.     End Sub
  64.  
  65.     Private Sub EsciToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EsciToolStripMenuItem.Click
  66.         MsgBox("Programma realizzato da Albertking82", MsgBoxStyle.Information, "Creatore")
  67.         End
  68.  
  69.     End Sub
  70.  
  71.     Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  72.         MsgBox("Programma realizzato da Albertking82", MsgBoxStyle.Information, "Creatore")
  73.         End
  74.     End Sub
  75.  
  76.  
  77.  
  78.     Private Sub mnuchar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuchar.Click
  79.         If mnuchar.Checked = False Then
  80.             txtasc.MaxLength = 3
  81.             mnuchar.Checked = True
  82.             mnuasc.Checked = False
  83.         End If
  84.  
  85.     End Sub
  86.  
  87.     Private Sub mnuasc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuasc.Click
  88.         If mnuasc.Checked = False Then
  89.             txtasc.MaxLength = 1
  90.             mnuasc.Checked = True
  91.             mnuchar.Checked = False
  92.         End If
  93.     End Sub
  94. End Class