Tuesday, October 27, 2009

Visual C++ 6 computer programming lesson. Building a Phone book Part - 2


* Now click in the 1st cell of INDEX column and type "1" in it. Then move to the 2nd cell by pressing the down arrow key, and type "2" in there (Pic 7).

* Again press the down arrow key and go to the 3rd cell. You'll see number 3 appearing in there automatically. Now press the down arrow key again and go to the 4th cell (Pic 8).



* To save the database press CTRL + S. OK the appearing dialog box (Pic 9).

* If the dialog box seen in picture 10 will open, click on the "No" button.



* Now go to the "PhoneBook:Database" window which is under the "Table 1" window, and right click on the "Table 1" item and select "Design View" (above picture).

* The "Design View" window will open (below picture).

* Right click on the row named "INDEX" which is under the "Field Name" column, and select "Primary Key" (Pic 11).



* Now go to the View menu, and select the item "Datasheet view" (above pic).

* If the dialog box seen in below picture will open, click the "Yes" button.



* Then again the Datasheet view window will open. Save the data base now.

* Now we must create a new column for storing names. To do this, go to the "Inset" menu and select "Column" item (pic 12). A new column named "Field 1" will be created before the Index column (pic 13).



* Right click on the "Field 1" header, select "Rename column" from the menu (pic 14). Now rename the "Field 1" header into "NAME" (pic 15). The program we're going to make will store the names (which are associated with the telephone numbers) in this column.



* Now create another new column named "TP" (pic 16). We use this column to store telephone numbers.

* Again create a new column named "PICTURES". We are going to use this column to store the Avatars of the people in the phonebook. Now the database should look like as shown in picture 17.

* Save the database and exit Ms Access.



Now what we have to do is to create a Data Source for our database. To connect the database to our program, we have to create a Data source. In the next post, we're gonna see how to do this in Windows Vista OS.

No comments:

Post a Comment