private void ListPicker_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         SelectedList = lstLists.SelectedItem as SPList;
         if (lvColumns.Items.Count > 0)
         {
             foreach (ListViewItem lvi in lvColumns.Items)
             {
                 SPColumn col = lvi.Tag as SPColumn;
                 if (col != null)
                 {
                     if (lvi.Selected)
                     {
                         if (!col.includeInCode)
                         {
                             SelectedList.AddColumnToCode(col);
                         }
                     }
                     else //don't include in code
                     {
                         if (col.includeInCode)
                         {
                             SelectedList.RemoveColumnFromCode(col);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ImportFromSharePointListTaskForm.DisplayError("Unexpected Error closing List Form", ex);
     }
 }
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (lvColumns.SelectedItems.Count > 0)
     {
         SPColumn col = lvColumns.SelectedItems[0].Tag as SPColumn;
         if (col != null)
         {
             _selList.RemoveColumnFromCode(col);
             UpdateColInfo();
             UpdateColButtons();
         }
     }
 }
 private void ListPicker_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         SelectedList = lstLists.SelectedItem as SPList;
         if (lvColumns.Items.Count > 0)
         {                   
             foreach (ListViewItem lvi in lvColumns.Items)
             {
                 SPColumn col = lvi.Tag as SPColumn;
                 if (col != null)
                 {
                     if (lvi.Selected)
                     {
                         if (!col.includeInCode)
                             SelectedList.AddColumnToCode(col);
                     }
                     else //don't include in code
                     {
                         if (col.includeInCode)
                             SelectedList.RemoveColumnFromCode(col);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ImportFromSharePointListTaskForm.DisplayError("Unexpected Error closing List Form", ex);
     }
 }