Link to home
Start Free TrialLog in
Avatar of Adnan
AdnanFlag for Norway

asked on

Getting row not in table exception: This row has been removed from a table and does not have any data.BeginEdit() will allow creation of new data in this row

Hi

I have never seen this exception before and iam stucked with how to resolve this...?
Can anyone guide how i can fix this?
public decimal Sum
        {
            get
            {
                decimal mySum = 0;

                foreach( DsReconItems.MatchItemRow row in reconcileRows )
                {
                    mySum += row.Amount;   GETTING EXCEPTION HERE
                }

                return mySum;
            }
        }

Open in new window

Avatar of Adnan
Adnan
Flag of Norway image

ASKER

i have 2 tab...one Search transactions tab, and one open transaction...when i search for some transactions and get the result, and then i switch to open transaction tab and back again i get this exception....it seems like the datatable get empety or something when i switch between two tabs... ???!
Avatar of saragani
saragani

Which UI are you working with (Winforms, WPF?)

I know for sure on WPF that when you switch tabs, the UI of the old tab get unloaded and when you return back to it, it reloads.


I can't understand the whole logic of your code without seeing it, but it must be something with the Load event.
(I can assume that you load your DsReconItems.MatchItemRow on your Load event of the UserControl/UI which is located inside the tab, am I right?)
Avatar of Adnan

ASKER

hi


yes man,i load my DsReconItems.MatchItemRow on Load event of the UserControl, wich is located inside the tab...????!
and iam working with WinForms, WPF!
Avatar of Adnan

ASKER

here is my code where i call tab_click event....

and at this line i call to function decimal Sum function where i get error...code above...
private void tabSrch_Click(object sender, EventArgs e)
        {
            if (showReconciled)
            {
                ReconManuallyGridView.Visible = true;
                btnReconcile.Text = GetValue("reconcile");
                ClearLeftRightPage();
                SetSelectedTab(tabButtonOpenItems);
                ShowReconciled();
            }
            if (manRecon.Diff != 0)
            {
                searchControl1.ClearControls();
                searchControl1.searchTextDecimalFieldAmount.TextBox.Text = manRecon.Sum.ToString();  I CALL TO DECIMAL Sum FUNCTIUN here....
            }

            SetSelectedTab(tabSrch);
            //ReconManuallyGridView.SendToBack();
            searchControl1.SearchDb();

        }

Open in new window

Avatar of Adnan

ASKER

if i change my code lines to:


                searchControl1.searchTextDecimalFieldAmount.TextBox.Text = manRecon.Sum.ToString();
                searchControl1.ClearControls();

The i stop getting this exception...but i want my data grid/dataset whatever to remeber those rows i had searched for before i swicthed to another tab and back again??!!! the state of the row is detached...?!
ASKER CERTIFIED SOLUTION
Avatar of saragani
saragani

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Adnan

ASKER

oki the issue here was that i was clearing my dataset before so i get this message...i have resolved it by clearing ds after....