Hey i am very new to vb.net and am creating a simple unit converter, i want my unit converter to display results in a listbox and want the user to be able to specify the start, step and end value in a For Next loop. Here is the code i have so far:
Public Class Form3
Private Sub lst1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstdata.SelectedIndexChanged
Dim Conversion As String
Conversion = lstdata.Items(lstdata.SelectedIndex)
Dim Math As Double
Dim number As Double
Dim start As Double
Dim increment As Double
Dim finish As Double
Select Case Conversion
Case "Grams to Ounces"
number = txt1.Text
Math = number * 0.0352739619
Case "Kilograms to Stones"
number = txt1.Text
Math = number * 0.157473044
Case "°Celsius to °Fahrenheit"
number = txt1.Text
Math = (number * 9 / 5) + 32
Case "Litres to Gallons"
number = txt1.Text
Math = number * 0.264172052
Case "Ounces to Grams"
number = txt1.Text
Math = number / 0.0352739619
Case "Stones to Kilograms"
number = txt1.Text
Math = number / 0.157473044
Case "°Fahrenheit to °Celsius"
number = txt1.Text
Math = (number - 32) * 5 / 9
Case "Gallons to Litres"
number = txt1.Text
Math = number / 0.264172052
End Select
start = txt2.Text
increment = txt3.Text
finish = txt4.Text
For Math = start To finish Step increment
lstoutput.Items.Add(Math)
Next
End Sub
I can't seem to get the list results to reflect the value math, please what am i doing wrong?? Any help would be very much appreciated. Cheers