![]() |
[Visual Basic 6.0] Binding Controls to DataFields
I have a database front end in which I'm experimenting with using properties, binding etc. instead of lots of longwinded code. I have textboxes and comboboxes bound to a data control, connecting to fields in a database (sorry if my terminology is a bit out here) This is working nicely except that editing any of the textboxes automatically changes the respective entry in the database, without me calling the update method.
By preference, it'd be set up so that when users edit a textbox, they have to click a button to update the database and otherwise it would just stay as it was. Question is, can this be done while I'm still binding controls to the data control or do I have to do it by steam? |
You should be able to use the UpdateRecord method of the data control in your button click event.
|
That's how I set it up originally, but it was updating records without the button being pressed. I think there's some property to do with the binding that I have to change, but I can't get the right window open to do it.
|
When do you think the update is occurring? Is it when your bound control loses focus? I created a simple test project with a textbox, button, and datacontrol. I linked the datacontrol to an access database and bound the textbox to a field in a test table. If I change the data in the textbox, the update will only occur when I change records (using the datacontrol), or execute the UpdateRecord method. Tabbing off the control does not cause an update.
|
All times are GMT -8. The time now is 09:45 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project