skp03 -2 Junior Poster in Training

the below code should be modified
for the button1 to open a file only admin can do it for that i want a password protection as the password is matched then admin can specify which .exe file should be on the button2

on the button2 .exe file should save it as it is

when we run for the 2nd time the same .exe file should be on the button2


////////////code\\\\\\\\\\\

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

With Button1 : .Text = ".open" : End With : With Button2 : .Text = ".fileName" : .Width += 123 : End With '// FOR TESTING.

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

With New OpenFileDialog
.Title = "Select a Cool File to load..."
' .Filter = ""
If .ShowDialog = Windows.Forms.DialogResult.OK Then
Button2.Text = IO.Path.GetFileName(.FileName) '// only FileName and .ext.
Button2.Tag = .FileName '// FullPath of .File, to load .File from.
End If
End With

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

With Button2
If Not .Tag Is Nothing Then Process.Start(.Tag.ToString) '// check if it has a .FullPath and load in/as default.
End With

End Sub
End Class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.