Click to See Complete Forum and Search --> : Please HELP!
Iceman
Jan 21st, 2000, 04:30 AM
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
Aaron Young
Jan 21st, 2000, 04:41 AM
Appart from being a mess, it works fine.
Did you add a CommonDialogBox called cdbSave to your Form?
Here's a cleaned up version:
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
Iceman
Jan 21st, 2000, 05:07 AM
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).]
DiGiTaIErRoR
Jan 21st, 2000, 09:30 PM
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
pdblake
Jan 21st, 2000, 09:54 PM
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
stop being such a jerk digital
DiGiTaIErRoR
Jan 21st, 2000, 10:39 PM
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
netSurfer
Jan 21st, 2000, 10:48 PM
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.
DiGiTaIErRoR
Jan 21st, 2000, 10:52 PM
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
Al Smith
Jan 21st, 2000, 10:58 PM
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>
Iceman
Jan 22nd, 2000, 02:10 AM
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.