Imports System.IO Imports System.Net.Security Imports System.Security.Cryptography Imports System.Text Imports System.Windows.Forms.VisualStyles.VisualStyleElement Public Class Form17 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If TextBox1.Text = "" Then MsgBox("merci d'entrer un nouveaux mots de passe", MsgBoxStyle.Critical) Else If TextBox2.Text = "" Then MsgBox("merci de confirmer", MsgBoxStyle.Critical) Else If TextBox1.Text = TextBox2.Text Then Dim texteEnBytes2() As Byte = Encoding.UTF8.GetBytes(TextBox1.Text) Dim keyBytes2() As Byte = Encoding.UTF8.GetBytes("Jj@msms7") Dim Crypto2 As New DESCryptoServiceProvider() Crypto2.Key = keyBytes2 Crypto2.IV = keyBytes2 Dim Icrypto2 As ICryptoTransform = Crypto2.CreateEncryptor Dim Resultatbytes2() As Byte = Icrypto2.TransformFinalBlock(texteEnBytes2, 0, texteEnBytes2.Length) Dim mailcrypte = Convert.ToBase64String(Resultatbytes2) Dim sw1 As New StreamWriter(dostemps & "pass.txt") sw1.WriteLine(mailcrypte) sw1.Close() Dim sw2 As New StreamWriter(doscompte & "passtemps.txt") sw2.WriteLine(mailcrypte) sw2.Close() uppass Else MsgBox("le mots de passe ne corsponds pas", MsgBoxStyle.Exclamation) End If End If End If End Sub Sub uppass() Try My.Computer.Network.UploadFile(dostemps & "pass.txt", ipserver & "utilisateur/" & nomutilisateur & "/pass.txt") File.Delete(dostemps & "pass.txt") MsgBox("votre mots de passe a bien êtê modifier", MsgBoxStyle.Information) Close() Catch ex As Exception Timer1.Start() End Try End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Timer1.Stop() Try My.Computer.Network.UploadFile(dostemps & "pass.txt", ipserver & "utilisateur/" & nomutilisateur & "/pass.txt") File.Delete(dostemps & "pass.txt") MsgBox("votre mots de passe a bien êtê modifier", MsgBoxStyle.Information) Close() Catch ex As Exception Timer1.Start() End Try End Sub Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click If TextBox1.UseSystemPasswordChar = True Then TextBox1.UseSystemPasswordChar = False Else TextBox1.UseSystemPasswordChar = True End If End Sub Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click If TextBox2.UseSystemPasswordChar = True Then TextBox2.UseSystemPasswordChar = False Else TextBox2.UseSystemPasswordChar = True End If End Sub End Class