Exception has been thrown by the target of an invocation.


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I received the following error when navigating away from an instance of the DevEx XtraGrid (bound to a BO via a BBS):

">

I have tried updating the framework (1.6.6 released version), then I tried updating to the most recent DevEx version (8.2.4).  I have removed the grid and replaced it with another instance.  All attempts have resulted in the same behavior.

Does anyone have any idea why the XtraGrid is causing this error to popup?  Btw, I can answer 'No' and continue using the form.  I'd really like to use the XtraGrid rather than the EnhancedList (which is nice, but lacks a couple of necessary features). 

Thanks for your help!
Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I'll try the image again:

In case the image upload fails again, it states, "Exception has been thrown by the target of an invocation.  Do you want to correct the value?"  The options are "Yes" and "No".

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Throw a datagridview on the form, bind it to the same datasource and run it.

Now, I have an error I can work with...one of the columns referenced does not belong to the table.  It is a custom property. 

This is the point where things get really, really fuzzy for me.

If I have a grid that is using a BBS to represent the data. 
And I have a BO that is pulling a subset of the original table (include some fields, exclude others) with additional fields for the presentation (field which are defined as custom properties in the BO). 
And I match a grid up to the BBS and select only the certain fields that I want displayed

Why would any other field not included in the query or the BO or the underlying datatable be accessed by the grid at any time?  This just doesn't make sense.

Thought I had a handle on the custom field thing, but I guess I don't.

Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Here is the code for the column that is generating the error:


public decimal LastInvQty
{
   
get
   
{
       
object mLastInvQty;
        mLastInvQty =
this.CurrentRow["LastInvQty"];
       
if (mLastInvQty == null)
        {
           
return 0;
        }
       
else
       
{
           
return (decimal)this.CurrentRow["LastInvQty"];
        }
    }
}

Should I be checking on the viability of this.CurrentRow["LastInvQty"] before assigning it to a variable?  Or, just don't assign it?  Like this:


public decimal LastInvQty
{
   
get
   
{
       
if (this.CurrentRow["LastInvQty"] == null)
        {
           
return 0;
        }
       
else
       
{
           
return (decimal)this.CurrentRow["LastInvQty"];
        }
    }
}

The second option seems to work...I will test a bit more.

Thanks,
Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Nope.  Still not behaving correctly.  Even if I add the custom fields to my stored procedure with 0 as the value, I am still getting the error.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Trent L. Taylor (08/27/2008)
You can take a mapped BO and bring any data into that you want.  If the strong-typed properties do not have an underlying column within the result set, then an error would occur if you referenced that strong-typed property.

I scrapped the BBS and decided to use a dataset derived from the BO, instead.  That has resolved the problem entirely.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Sonds goods...Smile
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Hey Trent,

Sorry to bring this up again...but I am now working on a window where I really need a BBS to interact with a DevExpress DataGrid.  To solve the previous problem, I resorted to a dataset (view only).  Now, I need to update the data and I would really like to take advantage of the existing plumbing.  Can you provide any direction on this?

Thanks,
Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Just to reiterate...the error does not appear with a DataGridView control...only with the DevEx XtraGrid control.  Same BBS.  Same BO.  I'll keep working on it.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
We have developers using a DevExpress grid and BBS objects every day.  So I really don't know what you are referring to here and exactly what issue that you are having.  A sample or more details would be helpful. 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search