HighTechTalks DotNet Forums  

Help not changing position on datasource.

Dotnet Framework (WinForms DataBinding) microsoft.public.dotnet.framework.windowsforms.databinding


Discuss Help not changing position on datasource. in the Dotnet Framework (WinForms DataBinding) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ken Foskey
 
Posts: n/a

Default Help not changing position on datasource. - 07-18-2008 , 07:59 AM







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

Reply With Quote
  #2  
Old   
Ken Foskey
 
Posts: n/a

Default Setting Position not changing position on datasource. - 07-21-2008 , 07:04 PM







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

Reply With Quote
  #3  
Old   
Ken Foskey
 
Posts: n/a

Default Setting Position not changing position on datasource. - 07-21-2008 , 07:04 PM




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

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.