• Log in or sign up for an account here: https://www.sythe.org/login

VB6: Can someone help me with code?

Cymru

Apprentice
Banned
Joined
Jan 22, 2007
Sythe Gold
0
Messages
693
Location
Down that alley...
VB6: Can someone help me with code?
I'm trying to get a simple code working. This is what I have up to now. Oh and I use C# and VB.NET so I hate VB6 and can never get it to work...

Private Sub Form_Click()
Dim Start As Label
Start:
If Dir("C:\notepad.txt") Then
Shell ("C:\notepad.txt")
Else: Form1.Caption = "failzorg"
End If
End Sub

Can someone tell me what is wrong, and give me a working script?

(this gives an error: type mismatch, but I also get other errors all the time).
It's like 7 lines of code, so can someone just fix it please?

THANKS
 
VB6: Can someone help me with code?
This is closer to what you want, but you can not shell a txt file.
Code:
Private Sub Form_Click()
    If Dir("C:\notepad.txt") <> "" Then
        Shell ("C:\notepad.txt")
    Else
        Form1.Caption = "failzorg"
    End If
End Sub
 
VB6: Can someone help me with code?
This is closer to what you want, but you can not shell a txt file.
Code:
Private Sub Form_Click()
    If Dir("C:\notepad.txt") <> "" Then
        Shell ("C:\notepad.txt")
    Else
        Form1.Caption = "failzorg"
    End If
End Sub
Precisely. You cannot shell a textfile, as a textfile isn't an executable program.

Try
Code:
 Shell "notepad C:\notepad.txt"

Though I haven't used VB6 in a while.
 
VB6: Can someone help me with code?
Try
Code:
 Shell "notepad C:\notepad.txt"

Though I haven't used VB6 in a while.
That works in the command prompt so it should do the same when you call it from VB6..
 
VB6: Can someone help me with code?
Thanks a lot. No wonder no matter what I did nothing worked... Thanks everyone.
 
Runescape Gamblingrunescape gambling
Back
Top