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.

Friday, October 23, 2009

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

(This tutorial is extracted from my book which i've written: "Visual C++ Projects")


Ok lets see how we can build a basic Phonebook programme, using Visual C++ 2005. For this, you also will need MS Access, to create the database for the program we'll be creating. I'm presenting this lesson both is Sinhala and English. Follow through the lesson with your desired language.
Now let's get started.

* First start MS Access.
* Now select File > New menu item inside Access.
* Go to the "New File" pane at the right side and click on the item named "Blank database". The "File new Database" dialog box will open (Picture 2).
* Through the dialog box, go to the place where you are planning to created the Phoonbook program, and create a new folder named "PhoneBook". For this, use could use the "Create New Folder" button inside the "File new Database" dialog box.




* Now in the "File name" field, type "PhoneBook".

* Finally to create Phonebook database, click on the "Create" button. The window seen in picture 3 will open.

* Double click on the "Create table by entering data" icon on that window. Data grid seen in picture 4 will open. This window is called "Datasheet view".

* Now as shown in picture 5, right click on column named "Field 1" and select the item "Rename Column".

* Rename the column name "Field1" to "INDEX" (Picture 6). We'll use this column to store the Index numbers of all telephone numbers.





To be continued..