37
Creating database applications in VB-Part I Visual basic allows programmers to manage databases created with different database programs such as MS Access, Dbase, Paradox and etc. In this lesson, we are not dealing with how to create database files but we will see how we can access database files in the VB environment. In the following example, we will create a simple database application which enables one to browse customers' names. To create this application, insert the data control into the new form. Place the data control somewhere at the bottom of the form. Name the data control as data_navigator. To be able to use the data control, we need to connect it to any database. We can create a database file using any database application but I suggest we use the database files that come with VB6. Let select NWIND.MDB as our database file. To connect the data control to this database, double-click the DatabaseName property in the properties window and select the above file, i.e NWIND.MDB. Next, double-click on the RecordSource property to select the customers table from the database. You can also change the caption of the data control to anything but I use "Click to browse Customers" here. After that, we will place a label and change its caption to Customer Name. Last but not least, insert another label and name it as cus_name and leave the label empty as customers' names will appear here when we click the arrows on the data control. We need to bind this label to the data control for the application to work. To do this, open the label's DataSource and select data_navigator that will appear automatically. One more thing that we need to do is to bind the label to the correct field so that data in this field will appear on this label. To do this, open the DataField property and select ContactName. Now, press F5 and run the program. You should be able to browse all the customers' names by clicking the arrows on the data control. The Design Interface. 1

Chapter 7 Creating Database Applications in VBrt I

Embed Size (px)

Citation preview

Page 1: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 1/37

Page 2: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 2/37

Page 3: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 3/37

Page 4: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 4/37

Page 5: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 5/37

Page 6: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 6/37

Page 7: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 7/37

Page 8: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 8/37

Page 9: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 9/37

Page 10: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 10/37

Page 11: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 11/37

Page 12: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 12/37

Page 13: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 13/37

Page 14: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 14/37

Page 15: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 15/37

Page 16: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 16/37

Page 17: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 17/37

Page 18: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 18/37

Page 19: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 19/37

Page 20: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 20/37

Page 21: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 21/37

Page 22: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 22/37

Page 23: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 23/37

Page 24: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 24/37

Page 25: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 25/37

Page 26: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 26/37

Page 27: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 27/37

Page 28: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 28/37

Page 29: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 29/37

Page 30: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 30/37

Page 31: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 31/37

Page 32: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 32/37

Page 33: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 33/37

Page 34: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 34/37

Page 35: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 35/37

Page 36: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 36/37

Page 37: Chapter 7 Creating Database Applications in VBrt I

8/3/2019 Chapter 7 Creating Database Applications in VBrt I

http://slidepdf.com/reader/full/chapter-7-creating-database-applications-in-vbrt-i 37/37