コード例 #1
0
        private void btnAddVolunteer_Click(object sender, EventArgs e)
        {
            frmAddItem dlg = new frmAddItem();

            dlg.IsVolunteer = true; //use the dialog to add volunteers
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                for (int i = 0; i < dlg.SelectedItems.Count; i++)
                {
                    CVolunteer vol = (CVolunteer)dlg.SelectedItems[i];
                    if (!lbxVolunteers.Items.Contains(vol.DisplayData()))
                    {
                        lbxVolunteers.Items.Add(vol.DisplayData());
                    }
                }
            }
        }
コード例 #2
0
        private void btnRemoveEquip_Click(object sender, EventArgs e)
        {
            frmAddItem dlg = new frmAddItem();

            dlg.IsVolunteer = false; //use the dialog to add equipment
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                for (int i = 0; i < dlg.SelectedItems.Count; i++)
                {
                    CEquipment Eqp = (CEquipment)dlg.SelectedItems[i];
                    if (!lbxEquipment.Items.Contains(Eqp.DisplayData()))
                    {
                        lbxEquipment.Items.Remove(Eqp.DisplayData());
                    }
                }
            }
        }