I have a four row table that I have built a select index off. I have an
on change even that is supposed to change the position of the binding
source that all fields on the screen are tied to:
position = DB.tblMatchBindingSource.Find("ID", select.Id);
DB.tblMatchBindingSource.Position = position;
DebugLabel.Text = String.Format("Select {0} - {1} - {2}", select.Id,
position, DB.tblMatchBindingSource.Position);
Problem is that the select.id is found and returns position 1 but the
binding source stays at 0. Occasionally it will allow it to switch.
Debug is 28 - 1 - 0
Yet it works for:
30 - 3 - 3
I have no idea why, any suggestions or something I should tie to the
datasource somewhere.
I have pulled all database out to a separate component. The screen has
no database in it at all. It is now done like this:
MatchVenue.DataSource = DB.tblVenueBindingSource;
MatchVenue.DataBindings.Add(new Binding("SelectedValue",
CricketDB.tblMatchBindingSource, "Venue"));
Ken
Ken Foskey - 22 Jul 2008 01:04 GMT
I still have this problem. The datasource will only change to records 1
and 4 of the datasource. I have tried a lot of variations to make this
work. The select is working and finding the position.
Only thing I can think of is that there are some subordinate tables not
populated on the non-selecting rows, I don't think that this is relevant.
MatchSelect select = (MatchSelect)Match.SelectedItem;
int oldPosition = DB.tblMatchBindingSource.Position;
int position = 0;
position = DB.tblMatchBindingSource.Find("ID", select.Id);
if (oldPosition + 1 == position)
{
DB.tblMatchBindingSource.MoveNext();
}
else if (oldPosition - 1 == position)
{
DB.tblMatchBindingSource.MovePrevious();
}
else
{
DB.tblMatchBindingSource.Position = position;
}
DebugLabel.Text = String.Format("Select {0} - {1} - {2}", select.Id,
position, DB.tblMatchBindingSource.Position);
Results are:
28 - 0 - 0
29 - 1 - 0
30 - 2 - 0
31 - 3 - 3
30 - 2 - 3
The 'current' record stays at either 3 or zero. I cannot understand why
so I cannot figure out this bug. Any help or suggestions appreciated.
If I use the datasource directly on the Combo it works but the
descriptive text on the combo must have three fields on it.
Ta
Ken