Im trying to design a module in which, using an equation, x and y coordinates are found and i want to display them in a list box.
The general idea in my mind is that the program asks the user to enter the length and number of divisions (lets suppose length is 1 and divisons are 1000) so 1 divided by 1000 equals 0.001, that is i want the value of x, starting from 0 then 0.001 then 0.002 then 0.003 and so on till 1 and its corresponding value of y and adding it simultaneously to the list box by using the for loop. I generally work on c++ but my project is on vb so im kinda having trouble. The result is that the textbox prints only two values of x that are 0 and 1. Here's the code. Would really appreciate the help.
Public Class Form9 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim n1 As Integer Dim n2 As Integer Dim n3 As Integer Dim div As Integer = 0 Dim lenght As Double = 0.0 Dim t As Double = n3 / 100 Dim x As Double =length / div If TextBox1.Text <> "" And TextBox2.Text <> "" And TextBox2.Text <> "" And TextBox3.Text <> "" And TextBox4.Text <> "" And TextBox5.Text <> "" Then n1 = CDbl(TextBox1.Text) n2 = CDbl(TextBox4.Text) n3 = CDbl(TextBox5.Text) num = CDbl(TextBox2.Text) chord = CDbl(TextBox3.Text) For x = 0 To length Dim y As Double = (((t / 0.2) * length) * ((0.2969 * (Math.Sqrt(x / length))) - (0.126 * (x / length)) - (0.3516 * ((x / length) ^ 2)) + (0.2843 * ((x / length) ^ 3)) - (0.1015 * ((x / length) ^ 4)))) ListBox1.Items.Add(x) Next x End If End Sub End Class