473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Automatically executing a subroutine when a form loads


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
4 1419
"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

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
Perhaps this link will help you:

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

And also this one

http://www.bobpowell.net

Nov 21 '05 #4
Perhaps this link will help you:

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

Also this one:

http://www.bobpowell.net

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Greg Scharlemann | last post by:
I would like to automatically populate a drop down menu when the page loads based on the selection of an item in a different drop down menu. I made a test page that when drop down #1 changes, drop...
0
by: sophocles the wise | last post by:
automatically post data & click buttons on sequence of web pages with AxWebBrowser Hi, I need to post stuff everyday to a website and am working on a VB program to do this for me. I am a...
4
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck...
3
by: Scott | last post by:
What is the proper syntax for sending an argument from a form contol to a subroutine in a module? For instance, from a textbox on a form I call a module subroutine from the textbox's OnUpdate...
0
by: jason | last post by:
some confusion here. The below code allows me to save a local file to my web server and somehow because the field type is file a local file browse button is rendered. I'm trying to figure out...
3
by: Academic | last post by:
If I do the following: System.Windows.Forms.Cursor.Current = Cursors.WaitCursor Do I need to reset the cursor or will that happen automatically when I leave the subroutine?
0
by: Mark | last post by:
Hi, I'm new to ASP.Net, but not to c#, so I'm finding some things a little wierd in this internet based world, especially passing data from page to page. I have created a UserControl to...
4
by: otterbyte | last post by:
Hi, I have a bit of code which is confusing me to no end. Here are the basics: 1) The class module is being used in the module of a form. 2) There is an instance of the object declared at the...
17
by: handique | last post by:
Hi, I have javascript code for rotating images, but the rotation starts only when mouse is placed over the image. But i want to rotate images automatically when the page loads. Can any guide me in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.