Automatically executing a subroutine when a form loads

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that displays a time vs temperature graph when the user clicks
a plot button. The plot is done in a picturebox using gr.drawline. I would
like for this plot to be made without the user having to click the plot
button, ie when the form opens.

I have tried putting the call to the plotting subroutine in various places:
the pbox.paint event, the form load event, and several other form events.
Nothing seems to work - I am not getting an error, just no graph. If I click
the button, it will still plot.

Any ideas how I might get this to automatically occur when the form opens?

Thanks
 
Mark Lancaster said:
I have a form that displays a time vs temperature graph when the user
clicks
a plot button. The plot is done in a picturebox using gr.drawline. I
would
like for this plot to be made without the user having to click the plot
button, ie when the form opens.

I have tried putting the call to the plotting subroutine in various
places:
the pbox.paint event, the form load event, and several other form events.
Nothing seems to work - I am not getting an error, just no graph. If I
click
the button, it will still plot.

Any ideas how I might get this to automatically occur when the form opens?


Perform the calculation in the form's 'Load' event handler, store the data
in a data structure and draw the graph in the form's 'Paint' event handler
or overridden 'OnPaint' method.
 
I did as you suggested. Now the plot flashes up temperarily in the picbox,
then it gets cleared. Any idea what I could be doing wrong, or have set
wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top