Hi Tevin,
Check this example. Now please take its reference and correct your code.
HTML
<asp:TextBox runat="server" ID="txtNumbers" TextMode="MultiLine" />
<asp:Button Text="Save" runat="server" OnClick="OnSave" />
Code
C#
protected void OnSave(object sender, EventArgs e)
{
List<double> numbers = new List<double>();
foreach (string number in txtNumbers.Text.Trim().Split('\n'))
{
if (!string.IsNullOrEmpty(number.Trim()))
{
numbers.Add(Convert.ToDouble(number.Trim()));
}
}
}
VB.Net
Protected Sub OnSave(ByVal sender As Object, ByVal e As EventArgs)
Dim numbers As List(Of Double) = New List(Of Double)()
For Each number As String In txtNumbers.Text.Trim().Split(vbLf)
If Not String.IsNullOrEmpty(number.Trim()) Then
numbers.Add(Convert.ToDouble(number.Trim()))
End If
Next
End Sub
Screenshot
Use the list to set the variables.