Hi Kevin,
I would recommend calling a custom method for your expression and return the string. In your method you would test if a parent row exists and it not then return an empty string.
>Hi, Cathi...
>
>Follow-up to my last question, where you suggested a data relation and an expression bound column, so that I could display data from a foreign table in a grid....something like
>
>ds.Tables[“Orders].Columns.Add(“CompanyName”, typeof(string),
> “Parent(CustomersOrders).CompanyName”);
>
>I implemented that and it worked great. Then I ran into a bit of a snag...it's possible [and I have no control over this] that a child table can have a key that isn't yet in the parent. When that occurs, I get an error on the line of code that sets the expression bound column...the error is...
>
><< Object reference not set to an instance of an object. >>
>
>Again, it only occurs when the child table has a key value [in this instance, a reason code] that doesn't yet appear in the master.
>
>I tried to set 'enforceconstraints' to false, but that didn't seem to work. Is there a way that I can keep this error from occuring?
>
>Thanks,
>Kevin
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi