Concerning showing the elapsed time on another form: I would suggest that operation you're doing when the button is clicked would be separated to a different, non-UI class. A method in this class would make the operation and for example using an event it would inform that operation is on-going and the amount of elapsed time.
In order for the UI to actually show the results, the operation should be run in another thread. Both forms would wire the event so that when the event from the class is raised, both forms could do what they want with the information.
So the class structure could be something like
- Form1
--- button
--- eventhandler for elapsed
- Form2
--- eventhandler for elapsed
- Class SomeName
--- ElapsedEvent
--- MethodName
In order to actually do this you should go through the documenation for:
-
BackgroundWorker[
^] for the actual operation
-
InvokeRequired[
^] tho show the elapsed time in UI thread
-
EventArgs[
^] to create custom event arguments for your event
To save the data you would need a number column in a table where you can store for example the amount of elapsed ticks. To manipulate the data you would need:
-
SqlConnection[
^]
-
SqlCommand[
^]
and to do the saving properly in the first place, also
SqlTransaction[
^]