//Dodawanie towaru private void towarToolStripMenuItem_Click(object sender, EventArgs e) { addTowary dodajT = new addTowary(towary, settings.vat); dodajT.ShowDialog(); towary = dodajT.towary; towary = towary.OrderBy(x => x.indeks).ToList(); odswiezT(); }
private string dodajTow(string ind) { int ile = towary.Count; addTowary dodajT; string txt = ""; if (ind == "") { dodajT = new addTowary(towary, vat); } else { dodajT = new addTowary(towary, vat, ind); } dodajT.ShowDialog(); if (towary.Count > ile) { txt = dodajT.pokazIndeks(); comboBox1.DataSource = null; bindingSource2.DataSource = null; comboBox1.Items.Clear(); towary = dodajT.towary; towary = towary.OrderBy(x => x.indeks).ToList(); towaryS = new List <string>(); String tekst; for (int i = 0; i < towary.Count; i++) { tekst = ""; tekst += towary[i].indeks; tekst += " | " + towary[i].nazwa; towaryS.Add(tekst); } bindingSource2.DataSource = towaryS; comboBox1.DataSource = bindingSource2; } return(txt); }