public MembershipSales() { //initialize component InitializeComponent(); string strFilePath = @"../../../Data/Pricing.txt"; //read Pricing.txt file and add items in cboMembership price try { StreamReader reader = new StreamReader(strFilePath); string price = reader.ReadLine(); while (price != null) { cboMembershipType.Items.Add(price); price = reader.ReadLine(); } } catch (Exception ex) { MessageBox.Show("Error in import process: " + ex.Message); } Pricing pricingNew = new Pricing(); }
private void btnSelect_Click(object sender, RoutedEventArgs e) { if (cboType.SelectedIndex == -1) { MessageBox.Show("Please select a membership type."); return; } string strType = cboType.Text; string strNewPrice = txtNewPrice.Text.Trim(); selectedPricing = pricingList.First(p => p.Type == strType); txtNewPrice.Text = selectedPricing.Price; cboOffered.Text = selectedPricing.Availability; }