Private Sub Command1_Click()
Text1.MaxLength = 4
If mnucodasc.Checked = True Then
Text1.Text = Asc(Text1.Text)
End If
If mnucodchar.Checked Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) < 58 Then
Text1.Text = Chr(Text1.Text)
Else
MsgBox "introduci un numero : Valore minimo 32-Valore massimo 255", vbInformation, "CODICE CHAR"
Text1.Text = ""
End If
End If
Command1.Enabled = False
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If mnucodchar.Checked = True Then
Command1.ToolTipText = "codifica il carattere corrispondente al codice inserito"
Else
Command1.ToolTipText = "codifica il codice ascii del carattere inserito"
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Sei sicuro di voler uscire?", vbYesNo, "esci") = vbNo Then
Cancel = True
Else
End
End If
End Sub
Private Sub mnucod_Click()
Form2.Show
End Sub
Private Sub mnucodasc_Click()
Form1.Caption = "codice ascii"
mnucodasc.Checked = True
mnucodchar.Checked = False
Command1.Caption = "codifica ascii"
Label1.Caption = "Inserisci il carattere"
End Sub
Private Sub mnucodchar_Click()
Form1.Caption = "codice char"
mnucodasc.Checked = False
mnucodchar.Checked = True
Command1.Caption = "codifica char"
Label1.Caption = "Inserisci ascii"
End Sub
Private Sub mnucolpul_Click()
colori.ShowColor
Command1.BackColor = colori.Color
End Sub
Private Sub mnucolsfondo_Click()
colori.ShowColor
Form1.BackColor = colori.Color
If Form1.BackColor = &HFF& Then
Label1.ForeColor = vbBlack
Else
Label1.ForeColor = vbRed
End If
End Sub
Private Sub mnuexit_Click()
Dim ris As Integer
ris = MsgBox("Sei sicuro di voler uscire?", vbQuestion + vbYesNo, "exit")
If ris = vbYes Then
End
End If
End Sub
Private Sub Text1_Change()
If Text1.Text = "" Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
If Command1.Enabled = True Then
mnucodasc.Enabled = False
mnucodchar.Enabled = False
Else
Command1.Enabled = False
mnucodasc.Enabled = True
mnucodchar.Enabled = True
End If
If mnucodasc.Checked = True Then
Text1.MaxLength = 1
End If
If mnucodchar.Checked = True Then
Text1.MaxLength = 3
End If
If Val(Text1.Text) > 255 Then
MsgBox "inserire un numero inferiore a 256"
Text1.Text = ""
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If mnucodchar.Checked = True Then
Select Case KeyCode
Case 32
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 48
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 106
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 107
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 109
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 187
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 188
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 189
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 190
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 219
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
Case 220
MsgBox "introduci un numero", vbCritical, "errore"
Text1.Text = ""
End Select
End If
End Sub