Public Class Form1
Private Sub Insert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Insert.Click
If (IsNumeric(TVal.Text)) Then
TListBox.Items.Add(TVal.Text)
TVal.Text = ""
End If
End Sub
Private Sub Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calculate.Click
If (TListBox.Items.Count > 0) Then
YListBox.Items.Clear()
For i As Integer = 0 To TListBox.Items.Count - 1
Dim t As Double = Convert.ToDouble(TListBox.Items(i).ToString())
Dim y As Double
If (t >= 0 And t < 5) Then
y = 1.5 * Math.Exp(-1.2 * t) + Math.Sqrt(t) + Math.Exp(-2.0 * t)
YListBox.Items.Add(y.ToString())
End If
If (t >= 5) Then
y = 2.5 * Math.Cos(t) + 1.2 * Math.Sin(t) + Math.Log10(t)
YListBox.Items.Add(y.ToString())
End If
If (t < 0) Then
y = 0
YListBox.Items.Add(y.ToString())
End If
Next
End If
End Sub
End Class