From: Helmut Meukel on
"MikeD" <nobody(a)nowhere.edu> schrieb im Newsbeitrag
news:%23Y%23GNac1KHA.2156(a)TK2MSFTNGP02.phx.gbl...
>
> "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message
> news:Ob2PUNa1KHA.2028(a)TK2MSFTNGP05.phx.gbl...
>> "mscir" <mscir(a)yahoo.com> schrieb im Newsbeitrag
>> news:hp6ahk$12m1$1(a)adenine.netfront.net...
>>> Also I've saved these over the years:
>>>
>>> 1------------------------------------------------------------------------
>>> Subject: Re: Unload Form, Set Form=Nothing, End, program doesn't end!
>>> Date: Thu, 19 Mar 1998 17:34:52 -0500
>>> From: "A Consultant" <consultant(a)towers.com>
>>> Newsgroups: microsoft.public.vb.general.discussion
>>>
>>> Make sure that you turn OFF all TIMER controls! Forms stay loaded if timers
>>> still active.
>>
>> As many suggestions made for avoiding End this one is plain wrong!
>> The Timer control that comes with VB6 is shut down automatically
>> when you unload the form it is placed on!
>>
>
>
> Naw, I can't agree with that statement hardly at all. Granted, what you say
> is true, but it's also true that the Timer control is not disabled until the
> form has COMPLETELY been destroyed. And invariably, the Timer control fires
> once more causing the form to either reload or prevents it from unloading due
> to the Timer event being on the stack. The shorter the timer's interval, the
> more likely you are to encounter this problem (but other factors are involved
> too). I consider it best practice to always explicitly disable Timer
> controls. At the very least, it certainly doesn't hurt anything whatsoever.
>
> --
> Mike
>


Mike,
this is my test program, 1 form, 1 timer, 1 command button.
I started with a timer interval of 10000 and went down to 10.
Always compiled the app and tested it with Taskmanager.
The app never remained, it always ended nicely.

Helmut.

Option Explicit

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
Timer1.Interval = 10
Timer1_Timer
End Sub

Private Sub Timer1_Timer()
Static cnt As Long
'simulating a log file
cnt = cnt + 1
Open "E:\tmp\Testfile.txt" For Append As #1
Print #1, cnt
Close #1
End Sub

From: MikeD on


"Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message
news:#vBistc1KHA.5996(a)TK2MSFTNGP05.phx.gbl...
> "MikeD" <nobody(a)nowhere.edu> schrieb im Newsbeitrag
> news:%23Y%23GNac1KHA.2156(a)TK2MSFTNGP02.phx.gbl...
>>
>> "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message
>> news:Ob2PUNa1KHA.2028(a)TK2MSFTNGP05.phx.gbl...
>>> "mscir" <mscir(a)yahoo.com> schrieb im Newsbeitrag
>>> news:hp6ahk$12m1$1(a)adenine.netfront.net...
>>>> Also I've saved these over the years:
>>>>
>>>> 1------------------------------------------------------------------------
>>>> Subject: Re: Unload Form, Set Form=Nothing, End, program doesn't end!
>>>> Date: Thu, 19 Mar 1998 17:34:52 -0500
>>>> From: "A Consultant" <consultant(a)towers.com>
>>>> Newsgroups: microsoft.public.vb.general.discussion
>>>>
>>>> Make sure that you turn OFF all TIMER controls! Forms stay loaded if
>>>> timers still active.
>>>
>>> As many suggestions made for avoiding End this one is plain wrong!
>>> The Timer control that comes with VB6 is shut down automatically
>>> when you unload the form it is placed on!
>>>
>>
>>
>> Naw, I can't agree with that statement hardly at all. Granted, what you
>> say is true, but it's also true that the Timer control is not disabled
>> until the form has COMPLETELY been destroyed. And invariably, the Timer
>> control fires once more causing the form to either reload or prevents it
>> from unloading due to the Timer event being on the stack. The shorter the
>> timer's interval, the more likely you are to encounter this problem (but
>> other factors are involved too). I consider it best practice to always
>> explicitly disable Timer controls. At the very least, it certainly
>> doesn't hurt anything whatsoever.
>>
>> --
>> Mike
>>
>
>
> Mike,
> this is my test program, 1 form, 1 timer, 1 command button.
> I started with a timer interval of 10000 and went down to 10.
> Always compiled the app and tested it with Taskmanager.
> The app never remained, it always ended nicely.
>
> Helmut.
>
> Option Explicit
>
> Private Sub Command1_Click()
> Unload Me
> End Sub
>
> Private Sub Form_Load()
> Timer1.Interval = 10
> Timer1_Timer
> End Sub
>
> Private Sub Timer1_Timer()
> Static cnt As Long
> 'simulating a log file
> cnt = cnt + 1
> Open "E:\tmp\Testfile.txt" For Append As #1
> Print #1, cnt
> Close #1
> End Sub

Sorry, but that proves nothing because it's not a real-world app. Google
the newsgroups. You'll see this issue has been brought up many times and
the recommended solution is to disable the timer control....and that's
always solved it.

--
Mike





From: Helmut Meukel on
"Karl E. Peterson" <karl(a)exmvps.org> schrieb im Newsbeitrag
news:OIywCNb1KHA.3588(a)TK2MSFTNGP05.phx.gbl...
> Helmut Meukel wrote:
>> So between VB-DOS and VB1 we lost the n% parameter, but VB did still all
>> necessary clean-up.
>
> Point of order. VBDOS actually came *after* VB1. But it did still retain the
> exitcode parameter so familiar to DOS junkies.
>
> Interesting addendum. To regain the exitcode capability, you essentially have
> to emulate END with a call to ExitProcess. <g>
>
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>


Karl,
you are right. My VB1 Manual is copyright 1991, VB-DOS 1992.

I played a bit around with VB1, but stayed with DOS Basic,
because it came with the ISAM database.
I was really pissed off when I found Microsoft provided no tool to
convert the ISAM database to an Access/Jet db or at least migrate
the data.

Helmut.

From: Helmut Meukel on
"MikeD" <nobody(a)nowhere.edu> schrieb im Newsbeitrag
news:OLXpO6c1KHA.3652(a)TK2MSFTNGP04.phx.gbl...
>
> Sorry, but that proves nothing because it's not a real-world app. Google the
> newsgroups. You'll see this issue has been brought up many times and the
> recommended solution is to disable the timer control....and that's always
> solved it.
>
> --
> Mike
>


Mike,

I can think of many things I could do in code - called by a timer event -
that would prevent VB to shut-down nicely, but then this code is the
culprit, not the running Timer control itself.
Disabling the Timer control may be the easiest solution to prevent this
code from interfering with a graceful shut-down, but the same will be
true for other controls firing events triggered externally.
The MSComm control comes to mind...

Helmut.

From: Karl E. Peterson on
Helmut Meukel wrote:
> "Karl E. Peterson" <karl(a)exmvps.org> schrieb...
>> Helmut Meukel wrote:
>>> So between VB-DOS and VB1 we lost the n% parameter, but VB did still all
>>> necessary clean-up.
>>
>> Point of order. VBDOS actually came *after* VB1. But it did still retain
>> the exitcode parameter so familiar to DOS junkies.
>
> you are right. My VB1 Manual is copyright 1991, VB-DOS 1992.

Yeah, I remember the sequencing well. VBDOS was such a disappointment,
too, because they never patched up the terrible resource problems it
shipped with.

> I played a bit around with VB1, but stayed with DOS Basic,
> because it came with the ISAM database.
> I was really pissed off when I found Microsoft provided no tool to
> convert the ISAM database to an Access/Jet db or at least migrate
> the data.

I didn't do a lot with ISAM, but recall finding some other 3rd party
alternative that gave me a pretty straight migration. But yeah, they
should've done something better there, too.

--
..NET: It's About Trust!
http://vfred.mvps.org


First  |  Prev  |  Next  |  Last
Pages: 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Prev: Convert UTF-16 Unicode to UTF-8 Unicode?
Next: API-Guide