Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42298

Launch Code From A Text Box

$
0
0
Hi,

I'm trying to see if I can launch a bit of code (program directory) from a textbox.

I'm looking to do this so that the user can chose the location of a directory of a program on there pc and type it into a text box so then when my program runs they can launch it directly from the program but due to the nature of some programs being in different locations I want to the user to be able to define where it is.

Currently it works like this:

Code:

#If True Then
    Private Sub CalculatorToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles CalculatorToolStripMenuItem1.Click
        On Error Resume Next
        AppActivate("Calculator")
        If (Err.Number <> 0) Then Shell("calc.exe")
    End Sub
#End If

The code checks to see if calculator is open and if it is brings it to the front and it it doesn't launch's it:
Code:

          If (Err.Number <> 0) Then Shell("calc.exe")
I want for it to do something like this with the directory in textbox1, but obviously this doesn't work.
If (Err.Number <> 0) Then Shell("textbox1.text)

Any Ideas or point in right direction??

Thanks

Viewing all articles
Browse latest Browse all 42298

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>