Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# graphing a function

Posted on 2003-03-25
Medium Priority
158 Views
Last Modified: 2010-05-01
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.
0
Question by:seanreynolds
8 Comments

LVL 16

Expert Comment

ID: 8206033
where do you want to draw them?
0

LVL 2

Expert Comment

ID: 8206145
Make a new application and add one command button, and one picturebox of whatever size you want it to be.  Paste this code.

Private Sub Form_Load()
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 Comment

ID: 8206153
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

LVL 2

Accepted Solution

Jacamar earned 200 total points
ID: 8206269
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

Author Comment

ID: 8206772
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

LVL 2

Expert Comment

ID: 8207488
Funny......I tried it on my machine before I gave it to you.  What didn't work about it?
0

Expert Comment

ID: 8531618
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

LVL 6

Expert Comment

ID: 9441058
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:

-->Accept Jacamar's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
###### Suggested Courses
Course of the Month14 days, 3 hours left to enroll

#### 581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.