using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class arvutus3 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { var paarid = File.ReadAllLines(Server.MapPath("~/App_Data/") + "kursid.txt"). Select(rida => rida.Split(new char[] { ' ' })); // ListBox1.Items.Clear(); if (!IsPostBack) { foreach (var paar in paarid) { ListBox1.Items.Add(new ListItem(paar[0], paar[1])); } } } protected void arvuta(object sender, EventArgs e) { Label1.Text = (double.Parse(ListBox1.SelectedValue) * double.Parse(TextBox1.Text)).ToString(); } }