i'm looking for doing a programe that solve this equation y=m*x+b

where m is the slope and equal m=(y2-y1)/(x2-x1)

and b is the intersect with y axssis

now i wanna to enter 4 vlaues x1 ,x2,y1,y2 in textbox to clalculate the m and b

and this is easey now what i wanna and the problem is

according to x vlaue calculate the y vlaue where x is the numbers in rang from x1 to x2 and print the result in richtext box

any soulations??????????

here is my code please correct it thanks

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace SniperDrawing { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void textBox5_TextChanged(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { int x1, y1, x2, y2, m, b, y; x1 = int.Parse(textBox1.Text); y1 = int.Parse(textBox2.Text); x2 = int.Parse(textBox3.Text); y2 = int.Parse(textBox4.Text); m = (y2 - y1) / (x2 - x1); b = y1 - m * x1; int x = x1; while ( x <= x2) { y=m*x1+b; richTextBox1.Text = Convert.ToString(y); for (int i = x1; i<= x2; i++) { richTextBox1.AppendText(Convert.ToString(y)); } x1 = x1 + 1; } } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { MessageBox.Show("Thanks trying my programe"); } } }