|
-
Sep 22nd, 2000, 09:32 AM
#1
Thread Starter
Lively Member
I get an "Illegal Operation" error and VB crashes with the following code:
Code:
Private Sub Upload()
With form1.Inet1
.Cancel
.Protocol = icFTP
.URL = "FTP://ftp.whatever.com"
.UserName = "username"
.Password = "password"
.Execute , _
"PUT " & local & " " & remote
DoLoop
.Execute , "QUIT" ' Close the connection.
DoLoop
End With
End Sub
Private Sub DoLoop()
Do
DoEvents
Loop While form1.Inet1.StillExecuting
End Sub
It gets through all this, but it crashes when I unload the form. Please help!
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 09:36 AM
#2
Frenzied Member
I don't seem to see the error, but why are you looping this twice?
Code:
Private Sub DoLoop()
Do
DoEvents
Loop While form1.Inet1.StillExecuting
It's just looping a DoEvents, why twice?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 22nd, 2000, 09:49 AM
#3
Thread Starter
Lively Member
I got that idea from another thread http://forums.vb-world.net/showthrea...threadid=31569 that uses the DoLoop subroutine after every Execute command. I believe it is supposed to give the server time to finish the action. What do you suggest?
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 09:55 AM
#4
Frenzied Member
Yeah I know DoEvents is supposed to give your program time to do other things while looping something. It's an error in the ITC control, therefore use DoEvents...
hmmm not seeing what the error is...
Maybe remove one of them...
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 22nd, 2000, 10:00 AM
#5
Thread Starter
Lively Member
I removed the second one and it still crashes! What I don't get it why it crashes when I unload the form, and not when it tries to execute these lines.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 10:04 AM
#6
Frenzied Member
Think that's because the loop is still executing at exiting, or are you using sublcassing anywhere in the prog?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 22nd, 2000, 10:14 AM
#7
Thread Starter
Lively Member
I'm still getting used to the programming lingo. Exactly what is subclassing?
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 10:30 AM
#8
Frenzied Member
maybe?
I'm not sure but try this:
On your unload:
Private sub Form_unload()
on error goto errhdl:
errhdl:
end
End sub
Try that!!!!
-
Sep 22nd, 2000, 10:41 AM
#9
Thread Starter
Lively Member
I tried it and I still get the error. It never gets to the handler. This error is not a run-time error, its a Windows error I guess. "VB - This program has performed and illegal operation and will be shut down". I swear I had this working yesterday!
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 10:51 AM
#10
Frenzied Member
Maybe it's dumb to ask, but have you tried rebooting?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 22nd, 2000, 11:00 AM
#11
Thread Starter
Lively Member
Tried it a few times. I also tried getting rid of the calls to DoLoop and even .Execute, "Quit". None of it works. I'm pretty sure it worked yesterday. Could it be a problem with my pc?
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 11:04 AM
#12
Frenzied Member
I assume you exit the prog by hitting the X button on the upper right, not the Vb STOP button.
Do you only have the crashes with this program or not?
If nothing helps, backup all your Vb Projects and try re-installing VB, otherwise try to run the code with no other programs running than Explorer and Systray.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 22nd, 2000, 11:27 AM
#13
Thread Starter
Lively Member
The program doesn't work no matter how I close it (VB Stop, X in top-right corner, Unloading through a quit button in my prog). It also crashes when I created an .exe and ran that w/ VB closed. But now I copied the code into a new VB project, with this code the only thing being performed, and it works when closing w/ any of the three methods! Now I'm really confused. I really don't think I need to do anything drastic like reinstall VB b/c I know this can work.
I'll try running it on a different pc.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 11:31 AM
#14
Frenzied Member
What kind a prog is it, are you using System Wide Hooks?
I forgot to answer your Q about what Subclassing is.
Look at these sites for info and lots of examples.
http://www.vbsquare.com/articles/subcls/
http://www.vbsquare.com/articles/sizegrip/
http://www.vbaccelerator.com
http://www.mvps.org/vbnet/
Is it a big/important prog?
Can you post the other code (you don't have to if you don't want) and are you using API?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 22nd, 2000, 11:43 AM
#15
Thread Starter
Lively Member
Thanks for answering the subclassing question. I'll look into it. To answer your question, no, its not a big/important program. Its a very small app that does a little file manipulation on my pc and uploads the file to an ftp. Here is the code that I have working in a new project, but that doesn't work with my original program:
Code:
Private Sub Upload()
With Inet1
.Cancel
.Protocol = icFTP
.URL = "FTP://ftp.whatever.com"
.UserName = "username"
.Password = "password"
.Execute , _
"PUT C:\local.txt UPLOAD/remote.txt"
DoLoop
.Execute , "QUIT"
End With
End Sub
Private Sub DoLoop()
Do
DoEvents
Loop While Inet1.StillExecuting
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
There are no API calls and the rest of the program is probably too long and doesnt affect this stuff. I really appreciate your help with this.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 22nd, 2000, 11:51 AM
#16
Frenzied Member
I find it pretty strange that this code works alone, but not along with the other code. Try to only run the other code alone without this FTP stuff, if it still crashes you know where the problem is.
Add me to ICQ if you want: 18818940
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 22nd, 2000, 02:56 PM
#17
Fanatic Member
I had that many times. It's because there's something wrong with his INET control. If it doesn't unload when closing the program then it's gonna do that.
Visual Basic 6.0
Visual C++ 5
Delphi 5

-
Sep 22nd, 2000, 03:37 PM
#18
Thread Starter
Lively Member
I gave up. I downloaded an FTP class from http://codeguru.earthweb.com/vb/articles/1852.shtml and it works great. I'd recommend it to anyone that was having the same problem as I was.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
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
|