Bound controls with Access Database

dawatson

Member
Joined
Sep 15, 2008
Messages
18
Programming Experience
10+
This is my first post to the forums. I think this is the correct forum. If not let me know.

I'm building a vb.net 2008 application with an Access 2003 backend.
Form controls are bound to the columns in a bindingsource component.
All data is returned using tableadapters that are part of datasets created with the dataset designer.

I don't have a good understanding of how the events related to row navigation should be used and why/when the events fire.

For example, after the user clicks one of the navigator buttons on the binding navigator, a few unbound textbox fields need to display calculated values using values from some of the bound controls.

I've tried the bindingcomplete event, but it fires multiple times.
It can fire 50+ times. I thought this event would fire one time after all the bound controls have been loaded.

I've tried the positionchanged event, but the data doesn't yet reflect the new record.

Also, when the form is first loaded, I can't seem to get access to data from the first record in a logical way.

I hope this is enough background.
The specific questions I have are:

For bound controls, which event fires when the record is completely loaded and I can use values in the record for calculations, etc.

Also, when a form is first loaded when is the first record in bound controls available.

Do I use the bindingsource, bindingnavigator, tableadapter to get access to the current record?

Thanks,
DW
 
Actually, you might be better off using extra columns in the datatable, and setting the EXPRESSION property to do the calculations, then binding to the calculated fields.. check it out by googling DataColumn.Expression

You use the bindingsource.Current property to get access to the current record. It returns you a DataRowView type object that you can ask for the .Row of, which returns your typed row (but you have to cast to get it type specific otherwise it will just come boxed as a DataRow generic type)
 
I had already started working on creating another column with an expression.
I wasn't sure it this was the only way. I've completed that and it works.
Thanks for your help.
 
Back
Top