English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

4 answers

I agree with Rawlyn !!

2006-09-20 02:41:35 · answer #1 · answered by Digitally Й!Й 3 · 0 0

The easiest to do this is using a function. Procedures and functions encourages code reuse. Example below:

Public Function EvaluateX(m As Single, x As Single, c As Single) As Double
EvaluateX = (m * x) + C
End Function

Using the function:
Private Sub Form_Load
MsgBox EvaluateX(5, 6 ,7)
End Sub

For more free VB source codes, visit: http://smartcoder.awardspace.com


KaBalweg
http://smartcoder.awardspace.com

2006-09-23 19:15:52 · answer #2 · answered by dabsani 3 · 0 0

From your question I understand that:
You enter values for x,m,c
You must find Y

First create your form:
---------------------------------
Label "X=" , TextBox1
Label "m=", TextBox2
Label "c=", TextBox3
Label "Y=mX+c"
Button "Evaluate"
---------------------------------

Double click the button
Now you can add your code:

Dim x as integer
Dim y as integer
Dim m as integer
Dim c as integer
x=TextBox1.Text
m=TextBox2.Text
c=TextBox3.Text
y=m*x+c;
MsgBox y

A picture of the form:
http://eroare.home.ro/eval.jpg

I hope I'm right. I'm not using VB anymore
C# rules!

---
Did you mean:
m,c -are constants
X is a varibile too
You must find out Y?

2006-09-20 01:00:08 · answer #3 · answered by simpaticool86 2 · 0 0

X=(Y-c)/m

Do the programming yourself, that's why your teacher gave you this assignment.

Rawlyn.

2006-09-20 00:25:24 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers