Chapter 20: List-Based Controls Visual C++ and MFC Fundamentals
// TODO: Add your control notification handler code here
// Empty the lists
m_SampleTables.ResetContent();
// Fill out the list
for(int i = 0; i < SizePersonal; i++)
m_SampleTables.AddString(Personal[i]);
// Select the first item in the list
m_SampleTables.SetCurSel(0);
}
- Execute the program to test it. Click the radio buttons and make sure that the content
of the Sample Tables list box changes based on the selected radio button. - After testing the dialog box, close it and return to MSVC.
- Add a new Static Text to the right side of the group box with a caption of
Sample Fields - Add a new List Box under the Sample Fields label. Set its ID to
IDC_SAMPLEFIELDS and remove the check box on its Sort property or set it to
False - Add a CListBox Control Variable to the IDC_SAMPLEFIELDS control and name
it m_SampleFields - In the header file of CTableWizardDlg class, declare additional CString arrays as
follows:
const CString Business[] = { "Contacts", "Customers", "Employees",
"Products", "Orders", "Suppliers",
"Payments", "Invoices", "Projects",
"Events", "Transactions" };
const CString Personal[] = { "Addresses", "Video Collection",
"Authors", "Books", "Categories",
"Music Collection", "Investments" };
const CString Contacts[] = { "MailingListID", "SocialTitle", "FirstName",
"MiddleName", "LastName", "Suffix",
"Nickname", "HomeAddress", "City",