Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / July 2008

Tip: Looking for answers? Try searching our database.

Help not changing position on datasource.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Foskey - 18 Jul 2008 13:59 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.