private void LoadTreeView() { tvWeaponList.Nodes.Clear(); List <WeaponType> lstWeaponType = new List <WeaponType>(); WeaponType objWeaponType = new WeaponType(); List <Weapon> lstWeapons = new List <Weapon>(); Weapon objWeapon = new Weapon(); if (!ckbHideNonProficientWeapons.Enabled) { lstWeaponType = objWeaponType.GetWeaponTypes("", "WeaponTypeName"); } else if (ckbHideNonProficientWeapons.Checked) { //Hide Non Proficent Weapons lstWeaponType = objWeaponType.GetCharacterProficientWeaponTypes(objCharacter.CharacterID); } else { //Show All Weapons lstWeaponType = objWeaponType.GetWeaponTypes("", "WeaponTypeName"); } foreach (WeaponType objListWeaponType in lstWeaponType) { lstWeapons = objWeapon.GetWeaponsByWeaponTypeID(objListWeaponType.WeaponTypeID); TreeNode objWTTN = new TreeNode(); objWTTN.Text = objListWeaponType.WeaponTypeName; objWTTN.Tag = objListWeaponType.WeaponTypeID; foreach (Weapon objListWeapon in lstWeapons) { TreeNode objTN = new TreeNode(); objTN.Text = objListWeapon.WeaponName; objTN.Tag = objListWeapon.WeaponID; objWTTN.Nodes.Add(objTN); } tvWeaponList.Nodes.Add(objWTTN); } }