How to link two checklistbox items?
<p>I'm using checklistboxes to display the FieldNames associated with a table (another checklistbox ). Multiple checklistboxes are generated dynamically and on checking any of the items from this fires an event 'OnCheckListBoxItemCheck' . Here the current item checked is obtained from the object 'sender'. The doubt is, how can i associate the item checked from the dynamic checklistbox and the item checked from the clbtables? Please Help...</p>

<pre><code> private void clbTables_ItemCheck(object sender, ItemCheckEventArgs e)
    {

        int indexofselectedtable;
        indexofselectedtable = Convert.ToInt32(clbTables.SelectedIndex);
        Metadata metadataobj = new Metadata(dbProperties);
        List&lt;string&gt; ColumnNames = new List&lt;string&gt;();
        ColumnNames = metadataobj.GetColumns(clbTables.Items[indexofselectedtable].ToString());
        chklistcolumns = new CheckedListBox();

      //Adds to the Checked ListBox
        for (int j = 0; j &lt; ColumnNames.Count; j++)
        {

            chklistcolumns.Items.Add(ColumnNames.ElementAt(j).ToString());
        }

        this.Controls.Add(chklistcolumns);
        //To fire event for a dynamically generated column checklistboxes
        chklistcolumns.ItemCheck += new ItemCheckEventHandler(OnCheckListBoxItemCheck);
    }
 private void OnCheckListBoxItemCheck(object sender, ItemCheckEventArgs args)
    {
            Columns columnobj = new Columns();
            columnobj.ColumnName = this.chklistcolumns.SelectedItem.ToString(); 
            columnobj.TableName = this.clbTables.SelectedItem.ToString();
            selectedColumnsList.Add(columnobj);

    }
</code></pre>
