-
Jan 21st, 2000, 05:30 AM
#1
Thread Starter
Lively Member
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
-
Jan 21st, 2000, 05:41 AM
#2
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
-
Jan 21st, 2000, 06:07 AM
#3
Thread Starter
Lively Member
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).]
-
Jan 21st, 2000, 10:30 PM
#4
So Unbanned
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
-
Jan 21st, 2000, 10:54 PM
#5
New Member
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
-
Jan 21st, 2000, 10:55 PM
#6
stop being such a jerk digital
-
Jan 21st, 2000, 11:39 PM
#7
So Unbanned
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
-
Jan 21st, 2000, 11:48 PM
#8
Hyperactive Member
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.
-
Jan 21st, 2000, 11:52 PM
#9
So Unbanned
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
-
Jan 21st, 2000, 11:58 PM
#10
Hyperactive Member
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>
-
Jan 22nd, 2000, 03:10 AM
#11
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|