Duh guys, move on. Vb6 is outdated.
Youre not annoying
Did you place a "Common Dialog Control" on your form? (Project -> Components -> Microsoft Common Dialog Control 6.0)
If you tell me the error, i can help you.
Duh guys, move on. Vb6 is outdated.
So? Its easy to learn, good for beginners.
So, up to now, I have selectet Project --> components --> Microsoft comm control 6.0
I have placed a button,
in the button I have this code:
End when I run the program an error pops-up saying:Code:Private Sub Command1_Click() With CommonDialog1 .FileName = "" .ShowOpen If .FileName <> "" Then RetVal = Shell("CommonDialog1.FileName", vbWindowState) End If End With End Sub
"Run-time error '424':
object required"
Ohh, well, I have done that..but, that's not what I want :/
I want to auto-open the file when I click the button..not selecting the file and then open them..
Okay you want to click a button, check if the file exists and if it exists, you want to start it?
yes..but the program will start it automatically, if it exists...NOT the user
I am sorry, but I told you I don't want to open something with a Path, that's because when someone downloads my software, the folder will be in the direction folder ( I mean where he wanted the software to be downloaded)...so it is not constant...
And you need to paste this function:Code:Dim file as string file = "C:\Yourfile.bat" If FileExists(file) = True Then Shell(file, vbWindowState) End If
You can get the directory of your program by using App.Path:Code:Function FileExists(File As String) As Boolean On Error Resume Next FileExists = False FileExists = Dir(File) <> "" End Function
Will give you something like "C:\MyProgram\"Code:App.Path & "\"
Last edited by edub18; 03-25-2011 at 03:58 PM.
lelelololele (03-25-2011)
Thanks for the source code, how ever, can I have a step by step tutorial?
pretty please :P
Tutorial? For what?
what to do exactly..I know it is a waste of time for you..but...if you have a website or something, I could mention that for credits..just, something in return :/