Problems with databindings

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2007
Posts: 68
Reputation: toadzky is an unknown quantity at this point 
Solved Threads: 0
toadzky toadzky is offline Offline
Junior Poster in Training

Problems with databindings

 
0
  #1
Oct 9th, 2008
I have a flat file database program I'm writing using SQLite3 and I've run into a problem and a question.

Problem: I have the various fields on the forms linked to the results of my queries using databindings. They all work just fine except for 2. They are pulled from a table after the rest of the data. They show up it I move to the next record and back but when I first get the results, everything else shows up but the 2. Any ideas?

Question: I want to have a label on the form that tells me where I am in the list and how many records there are. The formatting should be something like
  1. String.Format("Record {0} of {1}", current, count);
. Is there a way to do that with databindings so it updates as I scroll, even if I do a jump to the first or last record?

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Problems with databindings

 
0
  #2
Oct 9th, 2008
What event have you used to tell them to show?
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 68
Reputation: toadzky is an unknown quantity at this point 
Solved Threads: 0
toadzky toadzky is offline Offline
Junior Poster in Training

Re: Problems with databindings

 
0
  #3
Oct 9th, 2008
I select the parameters for the search and hit go. That populates the binding list.

I found a workaround but I would like to find a real solution. At the end of the search function, I call source.MoveLast() and then source.MoveFirst(). While this fixes the problem, I hate workarounds.

Also, I just finished adding all of my databindings and a section of them keep the rest from working.

  1. //Account Bindings
  2. i_AR.DataBindings.Add("Text", source, "AR");
  3. tx_Comments.DataBindings.Add("Text", source, "Comments");
  4. i_CSID.DataBindings.Add("Text", source, "CSID");
  5. i_Office.DataBindings.Add("Text", source, "Office");
  6. i_Rep.DataBindings.Add("Text", source, "Rep");
  7. i_Time.DataBindings.Add("Text", source, "Time");
  8. i_Date.DataBindings.Add("Text", source, "Date");
  9.  
  10. //Equipment Bindings
  11. i_Desc.DataBindings.Add("Text", source, "System.Upgrades");
  12. i_Upgrades.DataBindings.Add("Text", source, "System.Money");
  13. /* i_Panel.DataBindings.Add("Text", source, "System.Panel");
  14.   i_Cell.DataBindings.Add("Text", source, "System.Cell");
  15.   i_DW.DataBindings.Add("Text", source, "System.Doors");
  16.   i_GB.DataBindings.Add("Text", source, "System.Glassbreaks");
  17.   i_MD.DataBindings.Add("Text", source, "System.Motions");
  18.   i_SMK.DataBindings.Add("Text", source, "System.Smokes");
  19.   i_KF.DataBindings.Add("Text", source, "System.Keyfobs");
  20.   i_WF.DataBindings.Add("Text", source, "System.Wallfobs");
  21.   i_Panic.DataBindings.Add("Text", source, "System.Panics");
  22. */
  23. //Customer Bindings
  24. l_Customer.DataBindings.Add("Text", source, "Person.Name");
  25. l_Street.DataBindings.Add("Text", source, "Person.Address");
  26. l_City.DataBindings.Add("Text", source, "Person.City");
  27. l_State.DataBindings.Add("Text", source, "Person.State");
  28. l_Zip.DataBindings.Add("Text", source, "Person.Zip");
  29. l_Phone.DataBindings.Add("Text", source, "Person.Phone");

The commented out ones are the problem. No idea why. The only thing different about them is they have their own group box.
Last edited by toadzky; Oct 9th, 2008 at 9:34 pm. Reason: Another issue.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 68
Reputation: toadzky is an unknown quantity at this point 
Solved Threads: 0
toadzky toadzky is offline Offline
Junior Poster in Training

Re: Problems with databindings

 
0
  #4
Oct 10th, 2008
Update: There is only 1 of the bindings that's causing a problem. I added them in 1 at a time until all but the i_Panel worked. When I uncomment that one, they all break.

  1. i_Desc.DataBindings.Add("Text", source, "System.Upgrades");
  2. i_Upgrades.DataBindings.Add("Text", source, "System.Money");
  3. // i_Panel.DataBindings.Add("Text", source, "System.Panel");
  4. i_Cell.DataBindings.Add("Text", source, "System.Cell");

ALso, on the workaround, the main problem with it is that it doesn't work for searches that only return 1 record.

Thanks again.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 68
Reputation: toadzky is an unknown quantity at this point 
Solved Threads: 0
toadzky toadzky is offline Offline
Junior Poster in Training

Re: Problems with databindings

 
0
  #5
Oct 10th, 2008
Never mind. Stupid mistake. Sorry I wasted your time. I misnamed the property I was trying to access. Fixed it.

If you know how to make the string auto update when I change records tho, that would be nice.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Problems with databindings

 
0
  #6
Oct 10th, 2008
You mentioned the additional fields are not part of the original query, as they are not fields, (its 6.30am and Im half asleep) and my brain is saying that Id expect you to be using an event to display the row number etc.. so.. what event are you using to trigger the update of those fields?
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC