void Selection_SelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            if (FParentForm.FIAmUpdating == 0)
            {
                int         previousRowId = FPrevRowChangedRow;
                int         newRowId      = grdAccounts.Selection.ActivePosition.Row;
                DataRowView rowView       = (DataRowView)grdAccounts.Rows.IndexToDataSourceRow(newRowId);

                if (rowView == null)
                {
                    FPreviouslySelectedDetailRow = null;
                    FParentForm.SetSelectedAccount(null);
                    FParentForm.PopulateControlsAfterRowSelection();
                    Console.WriteLine("Selected row is NULL");
                }
                else
                {
                    FPreviouslySelectedDetailRow = rowView.Row;
                    String SelectedAccountCode = ((GLSetupTDSAAccountRow)rowView.Row).AccountCode;

                    FSelectionMadeInList = true;
                    FParentForm.SetSelectedAccountCode(SelectedAccountCode);
                    FSelectionMadeInList = false;

                    if (previousRowId == -1)
                    {
                        FParentForm.PopulateControlsAfterRowSelection();
                    }

                    Console.WriteLine("Row is {0}", FPreviouslySelectedDetailRow.ItemArray[1]);
                }

                FPrevRowChangedRow = newRowId;
            }
            else
            {
                Console.WriteLine("Skipping selection_changed...");
            }

            this.Cursor = Cursors.Default;
        }
Example #2
0
        private void TreeViewAfterSelect(object sender, TreeViewEventArgs treeViewEventArgs)
        {
            // System.Console.WriteLine("TreeViewAfterSelect: " + treeViewEventArgs.Node.Text);

            // store current detail values
            if ((FSelectedAccount != null) && (FSelectedAccount.linkedTreeNode != treeViewEventArgs.Node))
            {
                SetNodeLabel(FSelectedAccount.AccountRow);
            }

            FParentForm.SetSelectedAccount((AccountNodeDetails)treeViewEventArgs.Node.Tag); // This will change my FSelectedAccount

            FParentForm.PopulateControlsAfterRowSelection();
        }