1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| Option Explicit
Dim TT As Integer
Dim TextRecupe As String
Private Sub Form_Load()
Me.Height = 3645: Me.Width = 5205: Me.Caption = "Convertisseur"
Text1.FontName = "Courier New"
Text1.FontSize = 8
Text1.Move 120, 60, 4740, 795
Text1.BorderStyle = 1
Text1.Appearance = 0
'Text1.MultiLine = True <------------ A faire en desing -------------
Text1.Text = "00010000 00000010 01000011 00100000 00000011 00000010 11000100 00001001 11000100 00001001 00010100 00000000 01110110 00010000 00000011"
Command1.Move 120, 900, 2355, 435: Command1.Caption = "^-- Binnaire ---> Décimale --v"
Command2.Move 2555, 900, 2295, 435: Command2.Caption = "v-- Décimale ---> Binnaire --^"
Text2.FontName = "Courier New"
Text2.FontSize = 8
Text2.Move 120, 1380, 4740, 555
Text2.BorderStyle = 1
Text2.Appearance = 0
'Text2.MultiLine = True <------------ A faire en desing -------------
Text2.Text = ""
Command3.Move 120, 1980, 2355, 435: Command3.Caption = "^-- Ascii ---> caractère --v"
Command4.Move 2555, 1980, 2295, 435: Command4.Caption = "v-- caractére ---> Ascii --^"
Text3.FontName = "Courier New"
Text3.FontSize = 8
Text3.Move 120, 2460, 4740, 555
Text3.BorderStyle = 1
Text3.Appearance = 0
'Text3.MultiLine = True <------------ A faire en desing -------------
Text3.Text = ""
End Sub
Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then Exit Sub
Dim ArrayDataBin() As String
ArrayDataBin = Split(Trim(Text1.Text), " ")
TextRecupe = "": Text2.Text = ""
For TT = 0 To UBound(ArrayDataBin)
TextRecupe = TextRecupe & CStr(Bin8_Dec(ArrayDataBin(TT))) & " "
Next TT
TextRecupe = Left(TextRecupe, Len(TextRecupe) - 1)
Text2.Text = TextRecupe
End Sub
Private Sub Command2_Click()
If Trim(Text2.Text) = "" Then Exit Sub
Dim ArrayDataDec() As String
ArrayDataDec = Split(Trim(Text2.Text), " ")
TextRecupe = "": Text1.Text = ""
For TT = 0 To UBound(ArrayDataDec)
TextRecupe = TextRecupe & CStr(Dec_Bin8(CInt(ArrayDataDec(TT)))) & " "
Next TT
TextRecupe = Left(TextRecupe, Len(TextRecupe) - 1)
Text1.Text = TextRecupe
End Sub
Private Sub Command3_Click()
If Trim(Text2.Text) = "" Then Exit Sub
Dim ArrayDataCaract() As String
ArrayDataCaract = Split(Trim(Text2.Text), " ")
TextRecupe = ""
For TT = 0 To UBound(ArrayDataCaract)
If CInt(ArrayDataCaract(TT)) = 0 Then
TextRecupe = TextRecupe & "NULL"
Else
TextRecupe = TextRecupe & Chr(CInt(ArrayDataCaract(TT)))
End If
Next TT
Text3.Text = TextRecupe
End Sub
Private Sub Command4_Click()
If Trim(Text3.Text) = "" Then Exit Sub
Dim StrSoumis As String
StrSoumis = Trim(Text3.Text)
TextRecupe = "": Text2.Text = ""
For TT = 1 To Len(StrSoumis)
If (TT - 4) <= Len(StrSoumis) Then
If Mid(StrSoumis, TT, 4) = "NULL" Then
TextRecupe = TextRecupe & "0 ": TT = TT + 3
Else
TextRecupe = TextRecupe & AscW(Mid(StrSoumis, TT, 1)) & " "
End If
Else
TextRecupe = TextRecupe & AscW(Mid(StrSoumis, TT, 1)) & " "
End If
Next TT
TextRecupe = Left(TextRecupe, Len(TextRecupe) - 1)
Text2.Text = TextRecupe8
End Sub |
Partager