probléme sur Vbasic express
Posté : ven. 2 janv. 2015 22:46
bonsoir tous le monde, je suis entrain de créé un programme sur Vbasic express, j'ai plusieurs bouton, dont un qui active une fonction sur un fichier choisie au préalable, je n’arrive pas a rendre ce bouton inactif si aucun fichier est choisis, merci de m'apporter votre aide code de mon bouton.
" Private Sub jecrypte_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jecrypte.Click
Dim filein, filename, stub As String
Dim sfd As New SaveFileDialog
sfd.Filter = "Exécutables |*.exe "
If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
filename = sfd.FileName
End If
FileOpen(1, TextBox1.Text, OpenMode.Binary, OpenAccess.Read,
OpenShare.Default)
filein = Space(LOF(1))
FileGet(1, filein)
FileClose(1)
FileOpen(1, Application.StartupPath & "\stub.exe", OpenMode.Binary,
OpenAccess.Read, OpenShare.Default)
stub = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
FileOpen(1, filename, OpenMode.Binary, OpenAccess.ReadWrite,
OpenShare.Default)
FilePut(1, stub & filesplit & RC4(filein, "123456789"))
FileClose(1)
MsgBox("Le fichier à etais crypté avec succeè ! ")
If ProgressBar1.Value = ProgressBar1.Maximum Then
End If
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 100
Dim i As Integer
For i = 0 To 100
ProgressBar1.Value = i
Application.DoEvents()
System.Threading.Thread.Sleep(70)
Next
End Sub
Là il est brut,
" Private Sub jecrypte_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jecrypte.Click
Dim filein, filename, stub As String
Dim sfd As New SaveFileDialog
sfd.Filter = "Exécutables |*.exe "
If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
filename = sfd.FileName
End If
FileOpen(1, TextBox1.Text, OpenMode.Binary, OpenAccess.Read,
OpenShare.Default)
filein = Space(LOF(1))
FileGet(1, filein)
FileClose(1)
FileOpen(1, Application.StartupPath & "\stub.exe", OpenMode.Binary,
OpenAccess.Read, OpenShare.Default)
stub = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
FileOpen(1, filename, OpenMode.Binary, OpenAccess.ReadWrite,
OpenShare.Default)
FilePut(1, stub & filesplit & RC4(filein, "123456789"))
FileClose(1)
MsgBox("Le fichier à etais crypté avec succeè ! ")
If ProgressBar1.Value = ProgressBar1.Maximum Then
End If
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 100
Dim i As Integer
For i = 0 To 100
ProgressBar1.Value = i
Application.DoEvents()
System.Threading.Thread.Sleep(70)
Next
End Sub
Là il est brut,