How do I get timer to run independently & allow menu to activate something else

I have a form which immeiately starts a timer, it reads a database & compiles the number of pages for a report

The result of this, then changes the text on a menu to indicate the number of pages when the timer is finished

this timer can or cannot be time consuming depending on the number of pages it has to calculate

I want the timer to run independently, but it is stopping other functions that are in the menu

I get a message saying, 'not responding' on the form text, however this is resolved when the timer is finished

I want the user to be able to activate menu options whilst the timer is running until completion

I thought about adding a 2nd menu control, but it appears to be inactive, because when I run the app it is not visible, so I don't quite understand the rules for adding a second menu

any help much appreciated
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YOu can rn timer in a different thread

instead of

(in the toolbox under "components", not "windows forms")

The raised event will run in a different thread.

bemsonAuthor Commented:
Thanks for your reply

 It sounds a logical solution, however,

using the original concept I had where the timer activates on load of form 2, I still get the same effect with the component timer

trying a new approach, I still get the same result
form1 loads the form with the timer in it, so, to try & use another logic I started the timer in the 1st form (at it's conclusion), before loading the form that needed the result, I still get same result where I get the message 'Not responding' (when selecting the menu)

it seems that nothing will activate on the form until the timer has finished.

I have even put in doevents which does not seem to help

thanks for taking an interest in my problem
What if you put timer completely into different thread
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

bemsonAuthor Commented:
Thanks for your prompt reply

I am not exactly sure of the term thread, I presumed it meant activating that process at a different logical point in the app which I thought I had done by getting the timer to run from form 1 instaed of form 2

could you please enlighten me further on your interpretation of thread & how to achieve your solution
here is tutorial on multythreading

 If your application is going to perform a task that could take a
long time, such as parsing through a large recordset or performing a complex series
of mathematical calculations, you can push that processing off to its own thread so
that the rest of your application is still accessible. In VB6, , the best you could do to
keep the rest of the application from appearing to be locked was to use the DoEvents
Examine this code, which is written for VB.NET. Here you have some code for
button4. This code calls the BeBusy routine, which has a loop in it to just to take up
time. However, while in this loop, you are consuming the thread for this application,
and the UI will not respond while the loop is running.
The good news is the VB.NET IDE runs on
a separate thread, so if you find yourself waiting forever, just click on the IDE and
choose Stop Debugging from the Debug menu.

Private Sub button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles button4.Click
End Sub

Sub BeBusy()
Dim i As Decimal
For i = 1 To 10000000
‘do nothing but tie up app
End Sub

To create a thread, you must use the System.Threading.Thread class. In the creation
of the class, you pass in the name of the procedure or method you want to run on that
thread. You preface the procedure or method name with the AddressOf operator. Your
code would look like this:

Dim busyThread As New System.Threading.Thread(AddressOf BeBusy)

To fix the code and keep BeBusy from consuming the main program thread, you have
now created a new thread and will run BeBusy on that thread. However, that line of
code isn’t enough. Next, you must call the Start method on that new thread. With
VB.NET, calling BeBusy on its own thread would look like this:

Private Sub button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles button4.Click
Dim busyThread As New System.Threading.Thread(AddressOf BeBusy)
End Sub

No changes are required to the BeBusy procedure. If you now run this code, the interface
will remain active while BeBusy is running. The Beep in BeBusy will let you
know when the procedure has finished running.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bemsonAuthor Commented:
Thanks for your info re threads. I am using 2002

I will try to relate to this new process (for me) & attempt to apply it & see what transpires

I have to go out & will not be back for 7 hours, I will then attempt to implement your suggestion as described above, so I do not expect to be able to get back to you for about 24 hours

your assistance is much appreciated.
take your time and good luck
bemsonAuthor Commented:
I have been able to successfully implement your suggestion

Your interest & information is much appreciated
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.