private void CheckIfFieldIsSelected(String selectedTable)
 {
     for (int x = 0; x < chkListFields.Items.Count; x++)
     {
         if (SelectedTables.IsFieldSelected(selectedTable, chkListFields.Items[x].ToString()))
         {
             chkListFields.SetItemChecked(x, true);
         }
     }
 }
        private void chkListFields_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            CheckedListBox currentBox   = (CheckedListBox)chkListFields.Tag;
            CheckState     tableChecked = currentBox.GetItemCheckState(currentBox.SelectedIndex);

            if (e.NewValue.Equals(CheckState.Checked) && tableChecked == CheckState.Checked)
            {
                if (!SelectedTables.IsFieldSelected(currentBox.SelectedItem.ToString(), chkListFields.Items[e.Index].ToString()))
                {
                    SelectedTables.AddTableField(currentBox.SelectedItem.ToString(), chkListFields.Items[e.Index].ToString());
                }
            }
            else if (e.NewValue.Equals(CheckState.Unchecked) && tableChecked == CheckState.Checked)
            {
                SelectedTables.RemoveTableField(currentBox.SelectedItem.ToString(), chkListFields.Items[e.Index].ToString());
            }
        }