.. i have in my form a text box and 3 buttons one is for browsing the other is to execute what i browse and the other is to exit the program when there was a program set to run from my hard drive it was running smoothly with admin rights now that i have setup in order to run ffrom the text box value it will just run it will show the command line for a sec or two and it wont run the program that i have selected can someone help me??
Thanks
Here's the code that i have written and salvaged some from the internet.
Thanks
Here's the code that i have written and salvaged some from the internet.
VB.NET:
Option Explicit On
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim EMA
Dim readtext As String
readtext = TextBox1.Text
EMA = CreateObject("WScript.Shell")
'Replace the path with the program you wish to run c:\program files...
EMA.Run("RunAs /noprofile /user:administrator ""readtext""")
'Replace the string --> yourpassword~ with the
'password used on your system. Include the tilde "~"
EMA.Sendkeys("password~")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim neo As OpenFileDialog = New OpenFileDialog()
' Name of the open dialog Box
neo.Title = "Drive C"
' The Directory from where it starts searching the file
neo.InitialDirectory = "c:\"
' The filter of files that you wish to show
neo.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
neo.FilterIndex = 2
neo.RestoreDirectory = True
If neo.ShowDialog() = DialogResult.OK Then
TextBox1.Text = neo.FileName
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
End Class
Last edited by a moderator: