Results 1 to 11 of 11

Thread: Please HELP!

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83

    Post

    I have the following code and up till recent changes it would create the file....

    the first time through it gives no problems... but it doesn't create a file and when i click the button again all it does is flash and nothing happens....any help?

    Dim x As Byte
    Dim response As Integer
    Dim Filename, typetest As String
    Option Explicit

    Private Sub cmdcreate_Click()
    cdbsave.CancelError = True
    On Error GoTo saveerror
    cdbsave.Filter = _
    "Starcraft triggers (*.trg)|*.trg*"
    responseno:
    cdbsave.ShowSave
    Filename = cdbsave.Filename
    typetest = Right$(Filename, 4)
    If typetest = ".trg" Then
    Else
    Filename = Filename & ".trg"
    End If
    If Dir(Filename) = "" Then
    Else
    response = MsgBox("The file exists. Do you want to replace it?", 564, "Error: Same name")
    If response = 6 Then
    ElseIf response = 7 Then GoTo responseno
    End If
    End If
    x = 113
    Open Filename For Binary As #1
    Put #1, , x
    Close #1
    saveerror:
    End Sub

    Thats the entire code
    and by the way i hate no idea what "Option Explicit" does i just was told to use it in my vb programing class(a small one in a summer camp i didn't choose to take)

    later,
    Iceman

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Appart from being a mess, it works fine.
    Did you add a CommonDialogBox called cdbSave to your Form?

    Here's a cleaned up version:
    Code:
    Option Explicit
    
    Private Sub cmdcreate_Click()
        Dim lResponse As Long
        Dim sFilename, sType As String
        
        cdbSave.CancelError = True
        On Error GoTo SaveError
        cdbSave.Filter = "Starcraft triggers (*.trg)|*.trg*"
        Do
            cdbSave.ShowSave
            sFilename = cdbSave.Filename
            If LCase(Right$(sFilename, 4)) <> ".trg" Then
                sFilename = sFilename & ".trg"
            End If
            If Len(Dir(sFilename)) Then
                lResponse = MsgBox("The file exists. Do you want to replace it?", vbYesNo, "Error: Same name")
            End If
        Loop While lResponse = vbNo
        
        Open sFilename For Binary As #1
            Put #1, , CByte(113)
        Close #1
    SaveError:
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    ajyoung@pressenter.com


  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83

    Post

    But thats the problem IT DOESN'T WORK FINE!

    it worked fine till recently and thanks for that edited thingy ill try to figure out exactly what u did

    but i really don't understand why its not workin for me

    and what does the <> in your code mean?

    later,
    Iceman

    P.S. I tried your code in addition and got EXACTLY the same result no file created. What is wrong?!?

    [This message has been edited by Iceman (edited 01-21-2000).]

    [This message has been edited by Iceman (edited 01-21-2000).]

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    What does <> mean? LOL
    Remember:
    "There are no stupid questions, just stupid people."
    It means does not equal like:
    1 <> 2
    I think anyone that has taken 4th grade math knows this.

    ------------------
    DiGiTaIErRoR

  5. #5
    New Member
    Join Date
    Jan 2000
    Posts
    3

    Post

    Iceman,

    Have you tried it without the error traps?

    It still won't work but you'll find out where it stops working.

    Just downloaded the code by the way, I'll take a look when I get a chance

  6. #6
    Guest

    Post

    stop being such a jerk digital

  7. #7
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Wossname,
    1. If you don't know what <> means you shouldn't be a programmer.
    2. If #1 applies to you then you shouldn't have a computer.
    3. If #1 and #2 applies then repeat elementary school.
    Now, think about that.

    ------------------
    DiGiTaIErRoR

  8. #8
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Digital, I agree with Wossname, stop being a sjerk. If someone doesn't know then they should be able to ask without some smart ass insulting them for it.
    As for "1. If you don't know what <> means you shouldn't be a programmer." It depends on what language you code in. I've seen 'not equal to' written as != in quite a few so keep in mind that VB isn't the only language. Plus <> means something different in different Math disciples. But my point is that it's not necessary to insult someone over a question they ask.

  9. #9
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Again, hmmm this is funny... the banner (top of screen) says "Math is power". Basics like <> should be known before Text1.Text = "Hello World!".

    ------------------
    DiGiTaIErRoR

  10. #10
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330

    Post

    Hi,
    If we really want to get technical, <> means less than or greater than.
    Of course this is only semantics.
    Al.


    ------------------
    A computer is a tool, not a toy.
    <A HREF="mailto:asmith3914@aol.com
    asmith@spxateg.com">asmith3914@aol.com
    asmith@spxateg.com</A>


  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83

    Post

    ok i was wondering if they had a not equal(= with / through it)

    later
    Iceman

    P.S. I have never seen that before in my life and DiGiTaIErRoR you're an ass, though thanks to the others

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