D,
Did you try looking in the debugger? Before you make the assignment,
paste:
this.BindingContext[_dsTests.Relations["MyTestRelation"]]
Into the watch window.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
I'm not sure where to look for that, I mean I catch the exception but I
don't see where it reads about the actual object. After reading MSDN a
bit I tried casting it to a propertymanager which workd but I'm not
sure what to do next. More reading I guess.
Any thoughts?
Thanks for your help.
"Nicholas Paldino [.NET/C# MVP]" <
[email protected]>
wrote in message D,
What is the type that is returned when you key on the relation?
What does the debugger tell you?
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
I'm afraid I'm still getting an invalid cast exception error when
trying to do
CurrencyManager myCurrencyManager =
(CurrencyManager)this.BindingContext[_dsTests.Relations["MyTestRelation"]];
I have a feeling that I'm going to have to get current id from the
Tests table and seek out the highest totals in the DailyTotals
manually.
"Nicholas Paldino [.NET/C# MVP]" <
[email protected]>
wrote in message D,
Don't pass the string with the data relation name to the
BindingContext. Rather, pass the data relation itself, and you
should get it.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
I thought of that but I must have the syntax wrong because I'm
getting exceptions
_dsTests.Relations.Add("MyTestRelation",
_dsCombinations.Tables["Tests"].Columns["ID"],
_dsCombinations.Tables["DailyTotals"].Columns["ID"]);
later...
CurrencyManager myCurrencyManager =
(CurrencyManager)this.BindingContext["MyTestRelation"];
cast not valid
CurrencyManager myCurrencyManager =
(CurrencyManager)this.BindingContext["Tests.MyTestRelation"];
cast not valid
Thanks
"Nicholas Paldino [.NET/C# MVP]" <
[email protected]>
wrote in message D,
Are you sure you are getting the correct currency mananger?
When you are getting the currency manager, you need to get the
manager which is returned to you by using the DataRelation as the
key, not the child data table (which is why the position is
probably always zero).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
hi
I have a form with 2 datagrids showing related table data in a
master / child or order / order details type relationship. I
would like to auto select the row in the order details table
which contains the highest priced item. My thoughts were to get
the currency manager from the orderdetails table and iterate thru
each row and keep track of the highest item and row and select
that when done. I have found that for some reason the currency
manager of the order details table is always a position 0
regardless of what is actually showing in the order details
datagrid.
What am I doing wrong?
Thanks !!