|
Free
computer Tutorials
|
![]() |
home |
Stay
at Home and Learn
|
||||||
Building the Database Form |
|||||||
|
If you have Visual Studio and NOT the Visual Basic 2005 Express Edition, your tutorials are here: Visual Studio .NET and the database Wizard The first part of the tutorial is here: Database project for Visual Basic 2005 Express users
In the previous section, you saw how to open a Data Source. The fields from the database were then available to you in VB .NET. In this part, we'll see how to construct a form so that you can see and scroll through the data. In the last part, you had the Data Sources window displayed. This one (if you can't see the window, click Data from the menu bar. Then click Show Data Sources):
To add a Field to your Form, click on one in the list. Hold down your left mouse button, and drag it over to your form:
In the image above, the FirstName field is being dragged on the Form. Notice the mouse cursor has now changed. When your Field is over the Form, let go of your left mouse button. A textbox and a label will be added. There's two other things to notice: a navigation bar appears at the top of the form, and a lot of strange objects have appeared in the object area at the bottom:
We'll explore the Objects in a later section. But notice the Navigation bar in blue. Run your programme by hitting the F5 key on your keyboard. You should see this:
Click the Navigation arrows to scroll through the database.When you've played around with the controls, stop the form from running, and return to Design View.
No more reading these lessons online - get the eBook here!
Drag and Drop more Fields to your form. But don't align them yet. We'll see an easy way to do this. But once you've dragged the fields to your form, it might look like this:
I'm sure you'll agree - that's a very untidy form. But there's a very easy way to align all your controls. Try this:
With your new controls added, and nicely aligned, press F5 to run your form. You might have something like this:
Click the Navigation icons to move backwards and forwards through your database.
In the next part, you'll move away from the Wizards and learn how to add your own programming code to open up and manipulate databases.
Move on to the next part of the VB .NET Database Section --> |