Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing database/tableadapter at runtime

Status
Not open for further replies.

artyk

Programmer
Apr 5, 2006
163
US
I have a form that enables and disables controls based on whether there are any records in the table or not. For example, there is an Edit, and a Delete button that are only enabled if there are records and an Add button that is enabled at all times.

Everything works as it's supposed to except when adding records for the first time. The user is able to navigate to the form, click Add, and save the first record. However, at that point, the Edit and Delete buttons should then become enabled as there are records that could be edited or deleted. There is code in place to check for records in the table and it performs as it should outside of this one scenario.

Is there a command that is used for this specific type of thing? Thanks in advance!
 
How is the table populated? If you are using a bindingsource you can add to the bindingsource.listchanged method to see if there are any records present and modify the buttons accordingly.
 
Thanks, that put me on the right track!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top