Results 1 to 5 of 5

Thread: [Resolved by another ost]Having a problem running the program that i choose...

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    10

    [Resolved by another ost]Having a problem running the program that i choose...

    .. 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.
    vb.net Code:
    1. Option Explicit On
    2. Public Class Form1
    3.  
    4.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    5.         Dim EMA
    6.         Dim readtext As String
    7.         readtext = TextBox1.Text
    8.         EMA = CreateObject("WScript.Shell")
    9.         'Replace the path with the program you wish to run c:\program files...
    10.         EMA.Run("RunAs /noprofile /user:administrator ""readtext""")
    11.  
    12.         'Replace the string --> yourpassword~ with the
    13.         'password used on your system. Include the tilde "~"
    14.         EMA.Sendkeys("password~")
    15.     End Sub
    16.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    17.         Dim neo As OpenFileDialog = New OpenFileDialog()
    18.         ' Name of the open dialog Box
    19.         neo.Title = "Drive C"
    20.         ' The Directory from where it starts searching the file
    21.         neo.InitialDirectory = "c:\"
    22.         ' The filter of files that you wish to show
    23.         neo.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
    24.         neo.FilterIndex = 2
    25.         neo.RestoreDirectory = True
    26.         If neo.ShowDialog() = DialogResult.OK Then
    27.             TextBox1.Text = neo.FileName
    28.         End If
    29.     End Sub
    30.  
    31.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    32.         End
    33.     End Sub
    34. End Class
    Last edited by Nevara; Feb 24th, 2011 at 03:23 AM. Reason: Added Hightlight Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width