I'm going to attempt to answer my question, but I'm hoping someone will
correct me if I get it wrong.

First my call

BindingContext[lookupData, dataTable.ToString()].EndCurrentEdit();
should have read
BindingContext[lookupData, dataTable.TableName].EndCurrentEdit();

When I was tracing through the code, it appears that the BindingContext
contained 7 (?!? why so many?) objects, and when I created a new view by
using DefaultView, the line above does not refer to correct BindingManager.
What I did as a workaround was

BindingContext[listBox.DataSource].EndCurrentEdit();

which appears to work. How would I set things up if I wanted to use the same
binding manager in the first DataView (created by DefaultView), and the one
used by the listBox?

Thanks,
Erick

----- Original Message -----
From: "Erick Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 24, 2002 11:03 AM
Subject: [DOTNET] Question about DataView


I think I must be missing something basic about DataViews, because I have a
problem that I don't understand at all. I would really appreciate it if
someone could shed some light on this. What is the difference, as far the
currency manager goes, between a DataView created from DataTable.DefaultView
and a DataView explicitly created, then the Table property set? I'm getting
very different behaviours depending on how I create the DataView.

I have a WinForm with three main elements, a combobox, a listbox, and a
groupbox. The groupbox contains a number of bound fields. The dataset
contains two tables (A & B). What I am trying to do is have the listbox and
groupbox (and controls therein) bound to fields in table B, but have the
items in the listbox filtered by the selection of the combobox (bound to
table B). To do this, I bound the listbox and controls to a DataView.

In the combobox SelectIndexChanged event, I have
filteredView.RowFilter = "ThemeID = " + cboTheme.SelectedValue;

If I create the DataView explicitly, then when I call

BindingContext[lookupData, dataTable.ToString()].EndCurrentEdit();

the edits don't get picked up. But, if I create the view using
dataTable.DefaultView, then listbox and combobox's selections reset when I
click a button (I can provide more details here if needed), but the edits
are picked up. Any ideas?

Thanks, and sorry for the long post,

Erick

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to