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

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.

What event have you used to tell them to show?

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.

//Account Bindings
            i_AR.DataBindings.Add("Text", source, "AR");
            tx_Comments.DataBindings.Add("Text", source, "Comments");
            i_CSID.DataBindings.Add("Text", source, "CSID");
            i_Office.DataBindings.Add("Text", source, "Office");
            i_Rep.DataBindings.Add("Text", source, "Rep");
            i_Time.DataBindings.Add("Text", source, "Time");
            i_Date.DataBindings.Add("Text", source, "Date");

            //Equipment Bindings
            i_Desc.DataBindings.Add("Text", source, "System.Upgrades");
            i_Upgrades.DataBindings.Add("Text", source, "System.Money");
 /*           i_Panel.DataBindings.Add("Text", source, "System.Panel");
            i_Cell.DataBindings.Add("Text", source, "System.Cell");
            i_DW.DataBindings.Add("Text", source, "System.Doors");
            i_GB.DataBindings.Add("Text", source, "System.Glassbreaks");
            i_MD.DataBindings.Add("Text", source, "System.Motions");
            i_SMK.DataBindings.Add("Text", source, "System.Smokes");
            i_KF.DataBindings.Add("Text", source, "System.Keyfobs");
            i_WF.DataBindings.Add("Text", source, "System.Wallfobs");
            i_Panic.DataBindings.Add("Text", source, "System.Panics");
*/
            //Customer Bindings
            l_Customer.DataBindings.Add("Text", source, "Person.Name");
            l_Street.DataBindings.Add("Text", source, "Person.Address");
            l_City.DataBindings.Add("Text", source, "Person.City");
            l_State.DataBindings.Add("Text", source, "Person.State");
            l_Zip.DataBindings.Add("Text", source, "Person.Zip");
            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.

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.

i_Desc.DataBindings.Add("Text", source, "System.Upgrades");
            i_Upgrades.DataBindings.Add("Text", source, "System.Money");
 //           i_Panel.DataBindings.Add("Text", source, "System.Panel");
            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.

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.

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.