-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSelectMultipleItems.cs
More file actions
78 lines (63 loc) · 2.12 KB
/
SelectMultipleItems.cs
File metadata and controls
78 lines (63 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SqlStatementGenerator
{
public partial class SelectMultipleItems : Form
{
private ArrayList m_aryUserSelectedItems = new ArrayList();
public ArrayList UserSelectedItems
{
get { return m_aryUserSelectedItems; }
}
public string Description
{
set { lblDescription.Text = value; }
}
public SelectMultipleItems()
{
InitializeComponent();
}
public void Initialize(ArrayList aryItems, string sDisplayMember, bool bSorted)
{
// init the list
chklstListBox.Items.Clear();
if(sDisplayMember != string.Empty)
chklstListBox.DisplayMember = sDisplayMember;
chklstListBox.Items.AddRange(aryItems.ToArray());
chklstListBox.Sorted = bSorted;
}
private void btnSelect_Click(object sender, EventArgs e)
{
m_aryUserSelectedItems.Clear();
foreach (object itemChecked in chklstListBox.CheckedItems)
{
m_aryUserSelectedItems.Add(itemChecked);
}
this.DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void lnkCheckAll_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
for(int index=0; index<chklstListBox.Items.Count; index++)
{
chklstListBox.SetItemCheckState(index, CheckState.Checked);
}
}
private void lnkUncheckAll_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
for (int index = 0; index < chklstListBox.Items.Count; index++)
{
chklstListBox.SetItemCheckState(index, CheckState.Unchecked);
}
}
}
}