Inserting and Deleting Table Records

The form buttons each perform two different functions. When you click the Add button, your application will be placed into the insert mode. In this mode, the Add button will be changed to the Insert button, and the Delete button will be changed to the Cancel button. To accomplish this, you can create a private member variable of type bool, which signifies which mode you are in. Give this variable the name m_bInsertingRecord. You will first work on the New button.

Because the buttonNew_Click delegate needs to handle two tasks based on the Boolean value you created earlier, you will need to have two blocks of code. Whenever you click the New button, you will need to place the form into insert mode. This is done ...

Get Sams Teach Yourself Visual C++® .NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.