Author | Message | Time |
---|---|---|
BlazingKnight | How do you open another .exe file through a vb program? | November 3, 2003, 5:24 AM |
Newby | Correct me if I'm wrong. Shell filename 8) | November 3, 2003, 5:59 AM |
AzN | On Error GoTo ssfdsfds Shell "C:\Program Files\Starcraft\starcraft.exe" GoTo theend ssfdsfds: MsgBox "Error on loading file" theend: | January 5, 2004, 3:38 AM |
Adron | I recommend you insert a "Resume theend" right before theend:. If you don't finish error processing with a resume, any future error won't be handled right. | January 5, 2004, 4:16 AM |
drivehappy | Wouldn't a Exit Sub/Function be better than another Goto? | January 5, 2004, 5:46 AM |
Puzzle | [quote author=drivehappy link=board=31;threadid=3387;start=0#msg38421 date=1073281605] Wouldn't a Exit Sub/Function be better than another Goto? [/quote] Not unless that's the end of the sub or function which is most likely not the case. | January 5, 2004, 3:02 PM |
drivehappy | Well, just put the error label at the end: [code] Public Sub Blah On Error GoTo ssfdsfds Shell "C:\Program Files\Starcraft\starcraft.exe" MoreCrap() Exit Sub ssfdsfds: MsgBox "Error on loading file" End Sub [/code] | January 5, 2004, 5:38 PM |
Grok | My standard invocation is as follows: [code] Private Sub WhateverTask() On Error Goto WhateverTaskErr 'do stuff WhateverTaskExit: Exit Sub WhateverTaskErr: Dim lErr As Long, sErr As String, lLine As Long lErr = Err.Number : sErr = Err.Description : lLine = Erl Resume WhateverTaskExit End Sub [/code] There's a little more to it than that, depending on what the procedure is doing. I might put a Select..Case in the Error Handler, possibly a MsgBox and offer to Retry, Ignore or Cancel, depending on the error and what is appropriate. If they choose Cancel, you'd resume WhateverTaskExit. If they Retry, you Resume, and if they choose Ignore, you do Resume Next. What you get tired of write all those error handlers, you'll be practiced enough to start writing general error handlers, which requires a little advance maintenance in each procedure you want to take advantage of it. | January 5, 2004, 8:41 PM |
St0rm.iD | *sigh* VB error handling. | January 11, 2004, 4:30 AM |
Adron | [quote author=St0rm.iD link=board=31;threadid=3387;start=0#msg39222 date=1073795425] *sigh* VB error handling. [/quote] I've done that too. But vbdump.dll helps a lot! | January 11, 2004, 2:13 PM |
MesiaH | Are you just trying to open another application, or are you trying to open it as a child, and set your form as the parent? A long time ago, when i first got into programming, I was in open tech support, and skywing told me it was impossible, but it isn't :P Just wondering, reply if you need code for this technique. | January 17, 2004, 7:44 PM |
K | [quote author=MesiaH link=board=31;threadid=3387;start=0#msg39938 date=1074368669] Are you just trying to open another application, or are you trying to open it as a child, and set your form as the parent? A long time ago, when i first got into programming, I was in open tech support, and skywing told me it was impossible, but it isn't :P Just wondering, reply if you need code for this technique. [/quote] You mean using the SetParent function? | January 17, 2004, 8:47 PM |
MesiaH | yes, amungst a few others. | January 18, 2004, 7:37 PM |