Hello all,
I have a command button on a form that serves as a exit for the application.
The only code in the button is Application.exit. At run time the button when
tapped locks the device and the form freezes. Any ideas??
Thank you
chuck
Daniel Moth - 24 Apr 2006 22:57 GMT
Have you got any other threads running?
Rather than calling Application.Exit, make sure all your other threads have
terminated and then close the main form.
Cheers
Daniel
--
http://www.danielmoth.com/Blog/
> Hello all,
> I have a command button on a form that serves as a exit for the
[quoted text clipped - 5 lines]
>
> chuck
<ctacke/> - 24 Apr 2006 23:02 GMT
My guess is you have a worker thread doing something.
-Chris
> Hello all,
> I have a command button on a form that serves as a exit for the
[quoted text clipped - 5 lines]
>
> chuck
Jerome - 25 Apr 2006 10:27 GMT
Well, if only your application is launch, it is normal because when you type
your button exit (Application.Exit) your application stop refresh itself
because it is ended and as no other application form try to repaint itself,
you see your form and it sounds like freezes.
So i think it is normal, i have the same thing with my device..
If you launch the Explorer.exe, under your applicatiin, you will see your
application disapear..
Jérôme
> Hello all,
> I have a command button on a form that serves as a exit for the application.
[quoted text clipped - 3 lines]
>
> chuck
paulus - 25 Apr 2006 12:36 GMT
Thus ,
with Application.Exit I can quit my program.
How to call explorer?
Jerome schreef:
> Well, if only your application is launch, it is normal because when you type
> your button exit (Application.Exit) your application stop refresh itself
[quoted text clipped - 12 lines]
>>
>> chuck
<ctacke/> - 25 Apr 2006 13:40 GMT
Just use the System.Diagnostics.Process to launch explorer.exe. This
assumes you don't already have a shell running.
-Chris
> Thus ,
>
[quoted text clipped - 20 lines]
>>>
>>> chuck
<ctacke/> - 25 Apr 2006 18:35 GMT
Chuck,
If you need further help, please post here rather than directly emailing.
It allows the answer to potentially help others, plus I have a strict rule
on answering direct email because if I don't I get too much.
At any rate, if you're creating any worker threads (or creating objects that
create them) then you must ensure the workers are killed before exiting.
You don't give us much detail, like CF version, etc. so we can't offer much
more than that.
-Chris
> Hello all,
> I have a command button on a form that serves as a exit for the
[quoted text clipped - 5 lines]
>
> chuck
Chuck Hecht - 25 Apr 2006 19:15 GMT
Hi Chris
Sorry about the direct reply I clicked "Reply" not "Reply Group"
I am using VS2005 CF 2.0 The targeted device is a symbol PPT 8846 running
PPC 2003
I have the symbol SMDK(ver 1.1) installed
As I mentioned before the topic of threads has not been anyting that I have
been dealing with on
a routine basis.
****This is where I see 1 of the threads created
Public Function InitReader() As Boolean
If Not (Me.MyReader Is Nothing) Then
Return False
End If
Me.MyReader = New Symbol.Barcode.Reader
Me.MyReaderData = New Symbol.Barcode.ReaderData
Symbol.Barcode.ReaderDataTypes.Text, _
Symbol.Barcode.ReaderDataLengths.DefaultText)
Me.MyEventHandler = New System.EventHandler(AddressOf MyReader_ReadNotify)
****AddHandler Me.Activated, New EventHandler(AddressOf
frmMainForm_Activated)
AddHandler Me.Deactivate, New EventHandler(AddressOf frmMainForm_Deactivate)
Me.MyReader.Actions.Enable()
Return True
End Function
The other times occur when I call a function that pulls the serial number
from the device
Any help you can offer is greatly appreicated
Thanks again
chuck
> Chuck,
>
[quoted text clipped - 13 lines]
> > application.
> > The only code in the button is Application.exit. At run time the button
> > when
> > tapped locks the device and the form freezes. Any ideas??
> > Thank you
> >
> > chuck
<ctacke/> - 25 Apr 2006 19:59 GMT
I bet the barcode reader control spawns a separate thread. You should
destroy them before exiting, or better yet, exit the app the usual way by
closing the form instance passed to Application.Run.
-Chris
> Hi Chris
>
[quoted text clipped - 63 lines]
>> >
>> > chuck
Chuck Hecht - 25 Apr 2006 20:44 GMT
Hi Chris
This is what I am doing
Application.run(frmMain)
I have 3 exit buttons (3 different panels)
each button contains
frmMain.close
The form closes and it appears that the app is gone but if I try to get back
in to the app nothing happens it will not start and I need to soft reset the
device.
chuck
> I bet the barcode reader control spawns a separate thread. You should
> destroy them before exiting, or better yet, exit the app the usual way by
[quoted text clipped - 69 lines]
> >> >
> >> > chuck
<ctacke/> - 25 Apr 2006 20:46 GMT
Yep, it's definitely a thread. Try explicitly destroying and Disposing (if
they expose it) all of the barcode objects when you close the form.
-Chris
> Hi Chris
>
[quoted text clipped - 95 lines]
>> >> >
>> >> > chuck
Dick Grier - 26 Apr 2006 03:02 GMT
Hi,
You should have code like this:
Me.BarcodeReader1.Stop()
Me.BarcodeReader1.Dispose()
Me.Close()
or replace Me with this and add semicolons (C#).
Dick

Signature
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.