Monday, 17 October 2011

Connecting the Access Data Base with the VB Front end

                             This tutorial provides a brief introduction to developing database applications with Visual Basic through a series of nine step-by-step exercises. It should be noted that these exercises use the Data control with other controls bound to it. The Data control does a lot for you "behind the scenes" and you may be tempted to use it in your applications, but be advised that the Data control is rarely used in professional applications รข€“ the norm is to write your own database access code so that you have complete control over the process. These exercises are worthwhile in that you can see what data bound controls are all about, but again be advised that they should not be used for professional application development. 
                             
                              The intrinsic Data control is geared toward MS-Access 97 and earlier databases, although a later VB service pack added connectivity for Access 2000 databases. These articles use the two sample Access databases provided with Visual Basic (BIBLIO.MDB and NWIND.MDB). These databases are provided in Access 97 format. On a default installation of VB6, these databases can be found in the folder: C:\Program Files\Microsoft Visual Studio\VB98.
        
                             To do these exercises, you should make a folder into which you will copy the two database files mentioned above. Then, within the folder you have created, make separate subfolder for each exercise, one level below the root of your folder. The DatabaseName property for the Data control in these exercises assumes that the database file resides one directory level above the folder in which the exercise project files reside.
                               
STEPS:

1. Open a new Visual Basic project.

2. Put a data control (an intrinsic control, located in the VB toolbox) on the form and set the properties as follows:

Property
Value
(Name)
datAuthors
Caption
Use the arrows to view the data
Connect
Access (default)
DatabaseName
..\biblio.mdb
DefaultType
UseJet (default)
RecordSource
Authors (choose from list)

Notes: When you use the Data Control in a project, the properties that must be set areDatabaseName and RecordSource, in that order. DatabaseName is the name of the database you want to use, and the RecordSource is the name of the table in that database that you want to use.

3. On your form, create a text box for each field in the Authors table, with labels. (If you were to open the database in Access, you would see that the three fields of the Authors table are Au_ID, Author, and Year Born.) Set the properties of the three textboxes as follows:

Name
DataSource
DataField
txtAuthID
datAuthors
Au_ID
txtAuthor
datAuthors
Author
txtYearBorn
datAuthors
Year Born

In addition, set the Enabled property of txtAuthID to False.

When you want a control (such as a text box) to display data from a database, the properties that must be set are DataSource and Datafield. The DataSource is the name of the data control on the form (it should already be configured), and the DataField is the name of the particular field in the database that should be displayed in the control (this field will be in the table that was chosen for the RecordSource of the data control).

At this point, your form should resemble the screen-shot below:

4. Save and run the project. Use the arrows on the data control to scroll through the data.

5. On any record, change the data in the author name or year born field. Move ahead, then move back to the record you changed. Note that your changes remain in effect. The data control automatically updates a record when you move off of the record.

These are all the basic method for connecting the database with the VB applications.

Friday, 14 October 2011

Source code for simple visual basic application

Visual Basic is a wonderful language where we can easily create our own applications within a short span of time. It is actually a RAD tool to develop applications . We can create  simple applications for our needs and also we can do projects in visual basic language. If you have not enough amount of time to finish the project you can use the visual basic to finish the project.

Comparing to java concepts like swings and AWT tools we can create applications very fast manner by using this visual basic.
I have given some visual basic projects  that are created .

You can contact me by sathish kumar              mrsathishkumar1992@gmail.com


Visual Basic Source Code website                  http://www.devdos.com/vb/index.shtml