Urgent Datagrid/DataSet/BindingContext problem - (something new!)
From: Kris Shier (ks4hire_at__NOSPAM_yahoo.com)
Date: 05/06/04
- Next message: SEA Software: "Re: DATAGRID - during what event does the Detached row become Added?"
- Previous message: Kevin P. Fleming: "Re: DATAGRID - during what event does the Detached row become Added?"
- Next in thread: Kris Shier: "Re: Urgent Datagrid/DataSet/BindingContext problem - (something new!)"
- Reply: Kris Shier: "Re: Urgent Datagrid/DataSet/BindingContext problem - (something new!)"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 5 May 2004 23:09:15 -0400
I have been trying to fix this bug for months. I have no idea what the real
problem is - I was just hoping it would 'come out in the wash' at some
point, like most bugs do. I am close to delivering this app, and now I am
really crunching on trying to fix this problem, but I am making zero
progress. I have scoured the web looking for similar problems. (Everybody
has DataGrid problems, but not THIS one, it seems.)
There's this DataGrid, see? It's on a TabPage of a TabControl. It's bound
to the DataRelation of a DataSet with two tables in the common Master-Detail
configuration.
The bug I see at runtime is this: When I enter a new child row for a given
parent record, and it is the first child row for that record, when I tab out
of the last column of the row, the focus goes right back to the first column
of that row, instead of a new row, as it should.
At this point, the row I just added exists in a Detached state, but why
doesn't it get Added???
If I check the HasChanges property of the DataSet at this point, it claims
HasChanges = False. If I check the makeup of the DataTables themselves,
Master contains the expected parent record and Detail claims to contain 0
rows. This is consistent with this row still being Detached.
Now, If I tab through the entire row of the DataGrid again, this time, when
I tab out of the last column, the focus goes to a new row, as it should, and
the DataSet.HasChanges and Detail table row count contain their expected
values ('True', and '1', respectively).
It only has this problem when the row being added is the first Detail record
for a Master record. On subsequent adds, everything works as expected --
after tabbing out of the last column, the row is added to the DataSet, and
the focus arrives in the first cell of the next row (a blank row).
There are two other forms in my app that are based on the same base class as
this form, and have a similar arrangement: Master record fields displayed
in individual TextBox-type controls, and Detail record fields displayed in a
DataGrid. Both of these work as expected -- i.e. tabbing out of the last
column the FIRST time works fine -- the row gets added to the underlying
DataTable and the focus moves to the first cell of the next line.
Troubleshooting I have done:
- Checked to make sure that every object (Form, TabControl, TabPages, and
the DataGrid itself) are all using the intended BindingContext and
CurrencyManager/RelatedCurrencyManager. This is not the cause of the
problem.
- Tried to remove all controls from the TabPages and run it as a 'flat'
form. Problem not solved.
- Attempted to model every related object EXACTLY like other,
fully-functional forms in my app that use a parent/child model with a
datagrid for child records. Problem not solved.
- Made sure it was not caused incidentally by the DataGrid Leave Event
bug. I did have some advanced control enter/leave functionality going on,
but even with it all stripped out, I still see this problem.
Does anyone have ANY clue what might be wrong here? Even if it's just a
CLUE ... a direction to look in! Anything would help at this point.
On a related topic -- I'm open to suggestions on a 3rd-party .Net
WindowsForms datagrid that you would TRUST WITH YOUR LIFE! (i.e. with none
of the quirks of the MS one!) I would pay good money at this point, just to
put this bug to bed once and for all.
Thanks for reading,
Kris
- Next message: SEA Software: "Re: DATAGRID - during what event does the Detached row become Added?"
- Previous message: Kevin P. Fleming: "Re: DATAGRID - during what event does the Detached row become Added?"
- Next in thread: Kris Shier: "Re: Urgent Datagrid/DataSet/BindingContext problem - (something new!)"
- Reply: Kris Shier: "Re: Urgent Datagrid/DataSet/BindingContext problem - (something new!)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|