The information in this article applies to:
- Microsoft Visual Studio 97
SUMMARY
This article explains how to use the Microsoft RemoteData Control.
MORE INFORMATION
If you have installed Visual Studio 97 Service Pack 2 (SP2), the following
instructions will not work. You must install Visual Studio 97 Service Pack
3 (SP3). The instructions will also work with Visual Studio 97 and Visual
C++ version 5.0 without SP2.
- Create a new AppWizard (.exe) project. For this example, we will name
the project RDC. This example also uses the "StdReg32.mdb" database
file, from the Enroll tutorial. This sample assumes you have registered
the "Student Registration" database as described in the Enroll tutorial.
(See the InfoViewer topic "The Tutorial Example: Enroll" for more
information)
- In the MFC AppWizard Step 1, select Dialog Based, click Finished, and
click OK on the New Project Information dialog box.
- From the Project menu, click "Add to projects", and then select
"components and controls". Select the "Registered ActiveX Controls"
folder. Select "Microsoft RemoteData Control version 5.0" (RDC), and
click Insert. Click OK on the "Insert this component" dialog box. Then
click OK on the "Confirm Classes" dialog box.
- Use the same method to insert "Microsoft Masked Edit Control, version
5.0". Close the "Components and Controls Gallery" dialog box.
- Bring the Application Dialog (IDD_RDC_DIALOG) box into the resource
editor. Delete the "OK" and "Cancel" buttons, and the "TODO" static
text.
- Select the "Microsoft RemoteData Control" (RDC) from the control panel.
If the control panel is not mapped, right-click a gray area to the right
of the Microsoft Developer Studio menu and tool buttons and click
"controls."
- Insert the RDC into the dialog box. Insert a static text control below
it and label it "Course." Insert a "Microsoft Masked Edit Control" (MEC)
to the right of the Course static text control. Insert two more static
text controls and MEC's below the first pair. Label the static text
controls "Title" and "Hours."
- Right-click the RDC and select "Properties." Pin down the Properties
dialog box. Select the Control tab. In the DataSource list, select
"Student Registration." In the SQL edit box type "select * from course"
(don't include the quotes).
- In the Dialog Editor, select the course MEC. In the Properties dialog
box, click the All tab. The DataSource Property Value shows "<Not bound
to DataSource>." Use the drop-down list box to select the RDC you
inserted into the dialog box. (IDC_REMOTEDATACTL1 if you took the
default name) Change the DataField property to CourseID. Do the same for
the title and hours MEC's (except set the dataFields to "CourseTitle"
and "Hours").
- Build the application and test it. You should now be able to navigate
the Course table.
REFERENCES
Visual C++ Books Online: The Tutorial Example: Enroll
Keywords : MfcDatabase
Technology : kbole odbc kbMFC
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbhowto
|