By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

Automatically executing a subroutine when a form loads

P: n/a

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
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Mark Lancaster" <Ma***********@discussions.microsoft.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a

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?
"Herfried K. Wagner [MVP]" wrote:
"Mark Lancaster" <Ma***********@discussions.microsoft.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
Perhaps this link will help you:

http://www.bobpowell.net/picturebox.htm

And also this one

http://www.bobpowell.net

Nov 21 '05 #4

P: n/a
Perhaps this link will help you:

http://www.bobpowell.net/picturebox.htm

Also this one:

http://www.bobpowell.net

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.