|
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);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
SOFTWARE: Chris Hambleton is a Software Developer with proven experience in developing both web and Windows client-server applications with WPF, ASP.NET, C#, SQL Server, VB.NET, Visual C++, and VB6.
Chris's website is at
ChrisHambleton.com and he has a small web-hosting/consulting business called
CustomersInFocus.com. He has several other websites such as
EzekielWatch.com,
iWriterPro.com, and
BookBlitzer.com.
WRITING: He has also written several fiction books ("The Time of Jacob's Trouble" and "Endeavor in Time"), available at
CWHambleton.com and of course, at
Amazon.com (
Full Amazon Profile).