VB6: Can someone help me with code?

Discussion in 'Programming General' started by Cymru, Oct 21, 2008.

VB6: Can someone help me with code?
  1. Unread #1 - Oct 21, 2008 at 8:35 PM
  2. Cymru
    Joined:
    Jan 22, 2007
    Posts:
    693
    Referrals:
    0
    Sythe Gold:
    0

    Cymru Apprentice
    Banned

    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
     
  3. Unread #2 - Oct 21, 2008 at 10:56 PM
  4. jdsfighter
    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0

    jdsfighter Forum Addict
    Visual Basic Programmers

    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
     
  5. Unread #3 - Oct 22, 2008 at 3:04 AM
  6. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    VB6: Can someone help me with code?

    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.
     
  7. Unread #4 - Oct 22, 2008 at 8:14 AM
  8. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    VB6: Can someone help me with code?

    That works in the command prompt so it should do the same when you call it from VB6..
     
  9. Unread #5 - Oct 22, 2008 at 7:10 PM
  10. Cymru
    Joined:
    Jan 22, 2007
    Posts:
    693
    Referrals:
    0
    Sythe Gold:
    0

    Cymru Apprentice
    Banned

    VB6: Can someone help me with code?

    Thanks a lot. No wonder no matter what I did nothing worked... Thanks everyone.
     
< So, I wanna start Java.... | Hiring a programmer( Details Inside) >

Users viewing this thread
1 guest


 
 
Adblock breaks this site