Click here to Skip to main content
15,882,114 members
Home / Discussions / C#
   

C#

 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
PIEBALDconsult9-Sep-14 19:42
mvePIEBALDconsult9-Sep-14 19:42 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
SledgeHammer019-Sep-14 20:07
SledgeHammer019-Sep-14 20:07 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
Pete O'Hanlon9-Sep-14 20:46
mvePete O'Hanlon9-Sep-14 20:46 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
SledgeHammer0110-Sep-14 6:46
SledgeHammer0110-Sep-14 6:46 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
PIEBALDconsult10-Sep-14 3:14
mvePIEBALDconsult10-Sep-14 3:14 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
SledgeHammer0110-Sep-14 6:42
SledgeHammer0110-Sep-14 6:42 
Questionadd row to datagridview by checking child node check box of treeview Pin
Member 110597999-Sep-14 15:39
Member 110597999-Sep-14 15:39 
AnswerRe: add row to datagridview by checking child node check box of treeview Pin
Member 1105979911-Sep-14 7:55
Member 1105979911-Sep-14 7:55 
RESOLVED:

Added an 'else' to the AfterCheck so it simply calls getChildNodesToGrid()

I then updated private DataTable getFieldsTable() to add a counter and condition 'if (fileNode.Nodes[cnt].Checked)'.
Don't know if this is proper programming but seems to work.




C#
private void tvFileMan_AfterCheck(object sender, TreeViewEventArgs e)
 {
     getFileAndColumns();
     if (e.Node.Nodes.Count > 0)
     {
        //this.CheckAllChildNodes(e.Node, e.Node.Checked);
         // Checked a file so get fields and check all fields except subfiles.
         e.Node.Expand();
         foreach (TreeNode tn in e.Node.Nodes)
         {
             if (tn.Nodes.Count.Equals(0))
                 tn.Checked = e.Node.Checked;
         }
         getChildNodesToGrid();
     }
     else
     {
         e.Node.Expand();

             //if (tn.Nodes.Count.Equals(0))
             if (e.Node.Checked)
             {
                 //tn.Checked = e.Node.Checked;
                 getChildNodesToGrid();
             }

     }

private DataTable getFieldsTable()
 {
     //original
     DataTable dt = new DataTable();
     dt.Columns.Add("ColumnName");
     dt.Columns.Add("FMFieldName");
     dt.Columns.Add("FMFieldNumber");
     dt.Columns.Add("FMFileNumber");
     dt.Columns.Add("FMFieldType");
     dt.Columns.Add("ResolvedValue");
     dt.Columns.Add("PointsToFileNumber");
     TreeNode fileNode = tvFileMan.SelectedNode;
     int cnt = 0;
     foreach (TreeNode tn in fileNode.Nodes)
     {
         if (tn.Nodes.Count == 0)
         {
             if (fileNode.Nodes[cnt].Checked)
             {
              DataRow dr = dt.NewRow();

             dr["FMFieldName"] = tn.Text.Substring(tn.Text.IndexOf("  - ") + 4);
             dr["FMFieldNumber"] = tn.Tag.ToString();
             dr["FMFileNumber"] = tn.Parent.Tag.ToString();
             dr["ColumnName"] = suggestName(tn.Text.Substring(tn.Text.IndexOf("  - ") + 4));
             //added by TEA 9/3/14 to get PointsToFileNumber in DataGrid
             if (dr["PointsToFileNumber"].ToString().Length > 0)
             {
                 dr["ColumnName"] = suggestName(tn.Text.Substring(tn.Text.IndexOf("  - ") + 4) + "txt");
             }
             dt.Rows.Add(dr);
             }
             cnt++;
         }
     }
     return dt;

 }
private void getFileAndColumns()
 {
     label4.Visible = false;
     label5.Visible = false;
     btAllFields.Visible = false;
     cbComputed.Checked = false;
     TreeNode node = tvFileMan.SelectedNode;
     if (node == null) return;
     // Is it a File or Field?
     if (node.Index == 0) return;

     if (node.Nodes.Count > 0)
     {
         // FileManFile selected.
         // Check AttributeMap for this file. If found, fill in textboxes with that info.

         // Otherwise, suggest a name for the table.
         tbFileNumber.Text = node.Tag.ToString();
         tbFileName.Text = node.Text.Substring(node.Text.IndexOf("  - ") + 4);
         tbTableName.Text = "xxxx." + (suggestName(tbFileName.Text) + "F" + tbFileNumber.Text.Replace('.', 'x'));
         label4.Text = "To select all fields push button to the right. \nOtherwise double-click fields to add them one at a time.";
         label4.Visible = true;
         btAllFields.Visible = true;
         dgvColumns.DataSource = null;
         dgvPKIENS.DataSource = getPKIENSTable();
         getPKIENSIDs();
     }
     else
     {
         // FileMan Field selected.
     }


 }

QuestionChat Application Pin
Kevin Marois9-Sep-14 11:23
professionalKevin Marois9-Sep-14 11:23 
AnswerRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 11:36
professionalRavi Bhavnani9-Sep-14 11:36 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:37
professionalKevin Marois9-Sep-14 11:37 
GeneralRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 11:39
professionalRavi Bhavnani9-Sep-14 11:39 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:40
professionalKevin Marois9-Sep-14 11:40 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:46
professionalKevin Marois9-Sep-14 11:46 
GeneralRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 11:57
professionalRavi Bhavnani9-Sep-14 11:57 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:58
professionalKevin Marois9-Sep-14 11:58 
GeneralRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 12:00
professionalRavi Bhavnani9-Sep-14 12:00 
GeneralRe: Chat Application Pin
PIEBALDconsult9-Sep-14 13:58
mvePIEBALDconsult9-Sep-14 13:58 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 14:01
professionalKevin Marois9-Sep-14 14:01 
GeneralRe: Chat Application Pin
PIEBALDconsult9-Sep-14 14:16
mvePIEBALDconsult9-Sep-14 14:16 
AnswerRe: Chat Application Pin
PIEBALDconsult9-Sep-14 12:20
mvePIEBALDconsult9-Sep-14 12:20 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 12:27
professionalKevin Marois9-Sep-14 12:27 
GeneralRe: Chat Application Pin
PIEBALDconsult9-Sep-14 13:25
mvePIEBALDconsult9-Sep-14 13:25 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 15:07
professionalKevin Marois9-Sep-14 15:07 
GeneralRe: Chat Application Pin
PIEBALDconsult9-Sep-14 15:58
mvePIEBALDconsult9-Sep-14 15:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.