public void Delete(int num) { catg[count] = new market(); if (num >= 0 && num < count) { for (int i = num; i < count; i++) { catg[i] = catg[i + 1]; } count--; Real.Items.Clear(); RealPr.Items.Clear(); RealRes.Items.Clear(); for (int i = 0; i < count; i++) { Real.Items.Add(catg[i].name); RealPr.Items.Add(catg[i].name); RealRes.Items.Add(catg[i].name); } } }
public void Add(string now) { if (count < 100) { catg[count] = new market(); for (int i = 0; i < max_count; i++) { catg[count].pro[i] = new Product(); } catg[count].name = now; Real.Items.Add(now); RealPr.Items.Add(now); RealRes.Items.Add(now); Real.SelectedIndex = count; int visibleItems = Real.ClientSize.Height / Real.ItemHeight; Real.TopIndex = Math.Max(Real.Items.Count - visibleItems, 0); count++; } ; }