# graphing a function

I am not sure if this has already been answered. I have been looking but i havent found an answer i feel helps me.

I want to generate a list of plot points and plot them continously. or i want to be able to plot the sin function. either would be sufficient since i could just calculate the list points.

These points or functions will be created at run time.
###### 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.

IT OperationsCommented:
where do you want to draw them?
0
Commented:
Make a new application and add one command button, and one picturebox of whatever size you want it to be.  Paste this code.

Picture1.Scale (-1, 1.1)-(10, -1.1)
Picture1.Line (0, 1)-(0, -1)
Picture1.Line (0, 0)-(10, 0)
End Sub

Private Sub Command1_Click()
Dim sgPi As Single
Dim sgX(1 To 1000) As Single
Dim sgY(1 To 1000) As Single

sgPi = Atn(1) * 4

For inI = 1 To 1000
sgX(inI) = 10 / 1000 * inI
sgY(inI) = Sin(sgX(inI))
Next inI

For inI = 1 To 999
Picture1.Line (sgX(inI), sgY(inI))-(sgX(inI + 1), sgY(inI + 1))
Picture1.Refresh
Next inI
End Sub
0
Author Commented:
i would like to draw my graph in a form. just a regular form. I dont mind using anything i have to. i just want to run a program click a buton and see a sin graph with any x i put in.
0
Commented:
You can do the same thing I did above except use a form.  in te form load, add some code like so:

Form1.Height = 4000
Form1.Width = 8000

If you enter an X, it should return a Y, not a graph.  Just one point.
0

Experts Exchange Solution brought to you by

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

Author Commented:
to be honest your code didnt work. but you did enlighten me as to using line for graphing... i didnt know pictureboxes had a line function. so i figured it out anyway. but thanks for showing me the line function.
0
Commented:
Funny......I tried it on my machine before I gave it to you.  What didn't work about it?
0
Commented:
Hi seanreynolds,
This old question (QID 20562919) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

GPrentice00
Cleanup Volunteer
0
###### 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 Classic

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.