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
   |  
Imports System.IO
 
 
Public Class Form1
    Dim VCode As String = "-0-"
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close() 'si click Quitter ferme la forme1'
 
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim savefiledialog1 As New SaveFileDialog 'définition de savefiledialog1'
        savefiledialog1.Filter = "texte | *.txt" 'défintion du format de sortie'
 
        If savefiledialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
 
            Dim SW As New StreamWriter(savefiledialog1.FileName)
            SW.Write(TextBox1.Text)
            SW.Close()
 
        End If
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim openfiledialog2 As New OpenFileDialog
        openfiledialog2.Filter = "texte |*.txt"
        TextBox1.Text = ""
 
        If openfiledialog2.ShowDialog = Windows.Forms.DialogResult.OK Then
 
            Dim sr As New StreamReader(openfiledialog2.FileName)
            TextBox1.Text = sr.ReadToEnd
 
        End If
        Label3.Text = "caract. : " & Len(TextBox1.Text)
    End Sub
 
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim lgr As UInteger
        Dim i As Integer
 
        Dim longueur As String
        TextBox2.Text = ""
        longueur = Len(TextBox1.Text) 'compte le nombre de caractère'
        lgr = CInt(longueur) 'converti en numérique pour le boucle'
 
        For i = 1 To lgr
            TextBox2.Text = TextBox2.Text & Mid(TextBox1.Text, i, 1)
            TextBox2.Text = TextBox2.Text & VCode
        Next
 
        Dim savefiledialog2 As New SaveFileDialog 'définition de savefiledialog1'
        savefiledialog2.Filter = "texte | *.txt" 'défintion du format de sortie'
 
        Dim SW As New StreamWriter("C:\Users\CC\Desktop\test2.txt")
 
        SW.Write(TextBox2.Text)
        SW.Close()
        Label4.Text = "caract. : " & Len(TextBox2.Text) & "       soit " & ((Len(TextBox2.Text) - Len(TextBox1.Text)) / Len(TextBox1.Text) * 100)
 
 
 
    End Sub
 
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 
        Dim lgr, clef As UInteger
        Dim fichier As String = ""
 
        TextBox2.Text = ""
 
        lgr = CInt(Len(TextBox1.Text))
        clef = CInt(Len(VCode))
 
        Label4.Text = "caract. : " & Len(TextBox1.Text)
 
        For i = lgr To clef Step -clef - 1
 
            If i <= clef Then Exit For
            fichier = fichier & Mid(TextBox1.Text, i - clef, 1)
 
        Next
 
        fichier = StrReverse(fichier)
        TextBox2.Text = fichier
 
 
 
    End Sub
End Class | 
Partager