private void OnPanelClick(object sender, EventArgs e) { string[] name = ((Button)sender).Name.Split('-'); if (int.Parse(name[1]) != lastbutton) { Magazine magazine = Magazine.CreateFromID(int.Parse(name[1])); item.Product = magazine; item.Quantity = 1; lblName.Text = magazine.Name; lblIssue.Text = magazine.Issue; lblType.Text = magazine.Type; lblPublisher.Text = magazine.Publisher; lblPage.Text = magazine.Page.ToString(); lblQty.Text = item.Quantity.ToString(); lblPrice.Text = "€" + (item.Quantity * item.Product.Price).ToString("0.00"); } lastbutton = int.Parse(name[1]); }