private void Search_btn_Click(object sender, EventArgs e) { int headArmorMin, headArmorMax, bodyArmorMin, bodyArmorMax, legArmorMin, legArmorMax, thrustDamageMin, thrustDamageMax, swingDamageMin, swingDamageMax; #region SetValues foreach (Control c in itemsets_panel.Controls) { string nameEnd = GetNameEndOfControl(c); if (nameEnd.Equals("txt")) { if (!c.Text.Equals(setName_txt.Text)) { if (c.Text.Length == 0 || !IsNumberRange(c.Text) && !IsNumeric(c.Text)) { c.Text = "0"; } } } } string[] tmpS = headArmor_txt.Text.Replace(" ", string.Empty).Split('-'); headArmorMin = int.Parse(tmpS[0]); if (tmpS.Length > 1) { headArmorMax = int.Parse(tmpS[1]); } else { headArmorMax = headArmorMin; } tmpS = bodyArmor_txt.Text.Replace(" ", string.Empty).Split('-'); bodyArmorMin = int.Parse(tmpS[0]); if (tmpS.Length > 1) { bodyArmorMax = int.Parse(tmpS[1]); } else { bodyArmorMax = bodyArmorMin; } tmpS = legArmor_txt.Text.Replace(" ", string.Empty).Split('-'); legArmorMin = int.Parse(tmpS[0]); if (tmpS.Length > 1) { legArmorMax = int.Parse(tmpS[1]); } else { legArmorMax = legArmorMin; } tmpS = thrustDamage_txt.Text.Replace(" ", string.Empty).Split('-'); thrustDamageMin = int.Parse(tmpS[0]); if (tmpS.Length > 1) { thrustDamageMax = int.Parse(tmpS[1]); } else { thrustDamageMax = thrustDamageMin; } tmpS = swingDamage_txt.Text.Replace(" ", string.Empty).Split('-'); swingDamageMin = int.Parse(tmpS[0]); if (tmpS.Length > 1) { swingDamageMax = int.Parse(tmpS[1]); } else { swingDamageMax = swingDamageMin; } #endregion items_lb.Items.Clear(); foreach (Item item in items) { if (item.HeadArmor >= headArmorMin && item.HeadArmor <= headArmorMax && item.BodyArmor >= bodyArmorMin && item.BodyArmor <= bodyArmorMax && item.LegArmor >= legArmorMin && item.LegArmor <= legArmorMax && item.ThrustDamage >= thrustDamageMin && item.ThrustDamage <= thrustDamageMax && item.SwingDamage >= swingDamageMin && item.SwingDamage <= swingDamageMax /*&& item.Something >= somethingMin && item.Something <= somethingMax*/ ) { items_lb.Items.Add(itemsIDs[CodeReader.GetItemIndexFromID(item.ID)]); } } }