A voir également:
- Transformation de code
- Code ascii - Guide
- Code puk bloqué - Guide
- Code de déverrouillage oublié - Guide
- Code activation windows 10 - Guide
- Scanner qr code pc - Guide
2 réponses
Imports System.IO
Imports Bastien_getion_fichiers_bernard
Public Class Form1
Private Sub Button_quitter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_quitter.Click
Dim modif As Boolean
Dim MonFichier As String
Dim Chaine As String
Dim reponse As String
MonFichier = ("c:\bastien\bastien\Gestion fichier bernard\Gestion.log")
Chaine = "Le" & Format(Now, " dd-MM-yyyy ") & "à" & Format(Now, " hh:mm:ss") & ": Fermeture du programme."
If modif <> True Then
reponse = MsgBox("Voulez-vous vraiment quitter ?", MsgBoxStyle.YesNo, "Confirmation")
If reponse = vbYes Then
FileOpen(1, MonFichier, OpenMode.Output)
Print(1, Chaine)
FileClose(1)
Close()
End If
End
End If
End Sub
Private Sub Button_valider_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_valider.Click
Dim Path As String
Path = "C:\bastien\bastien\Gestion fichier bernard\Gestion" & ".data"
If File.Exists(Path) = False Then
My.Computer.FileSystem.WriteAllText(Path, TextBox_champ.Text, False)
FileClose(1)
MsgBox("Modifications sauvergardées avec succès", MsgBoxStyle.OkOnly, "Sauvegarde")
Me.Close()
Else
My.Computer.FileSystem.WriteAllText(Path, TextBox_champ.Text, False)
FileClose(1)
MsgBox("Modifications sauvergardées avec succès", MsgBoxStyle.OkOnly, "Sauvegarde")
Me.Close()
End If
End Sub
Private Sub Button_annuler_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_annuler.Click
Dim chaine, reponse, Path, MonFichier As String
Dim modif As Boolean
reponse = MsgBox("Etes-vous sur de vouloir annulé?", MsgBoxStyle.YesNo, "Annulation")
Path = "C:\bastien\bastien\Gestion fichier bernard\Gestion" & ".data"
MonFichier = ("c:\bastien\bastien\Gestion fichier bernard\Gestion.data")
If modif = True Then
If reponse = vbYes Then
FileOpen(1, MonFichier, OpenMode.Input)
Input(1, Path)
TextBox_champ.Text = Path
FileClose(1)
End If
Else
End If
My.Computer.FileSystem.WriteAllText(Path, TextBox_champ.Text, False)
chaine = "C:\bastien\bastien\Gestion fichier bernard\Gestion.log"
FileOpen(1, chaine, OpenMode.Output)
Print(1, (Format(Now, "hh:mm:ss") & " : annulation des données de la textbox : " & TextBox_champ.Text))
FileClose(1)
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim MonFichier, MaVariable As String
MonFichier = ("c:\bastien\bastien\Gestion fichier bernard\Gestion.data")
If File.Exists(MonFichier) = True Then
FileOpen(1, MonFichier, OpenMode.Input)
Input(1, MaVariable)
TextBox_champ.Text = MaVariable
FileClose(1)
Else
FileClose(1)
End If
End Sub
End Class