Google Search

Google
 

Sunday, May 25, 2008

Video: How Do I: Create a One-to-Many Data Entry Form?

Presenter:Beth Massi


Visual Basic programmers will see how to create a One-to-Many (Master-Detail) Data entry form using the Data Sources Window and the Windows Forms designer in Visual Studio.

Click here to go to original video page


Minute 0

A k a Mr Massey and welcome to the Windows forms of a deity a series in this video was going to create a one to many data entry form this video builds upon the database that we created in the first video and application that we started in the second call the order manager and I have that open now so why do you want to create a form that displays our customers and their orders so first let s create a new Windows form in a right click on the project select add new item and select Windows form and bridges in the coliform to
Minute 1

Or his sword and a select add new data source cheese database as a data source type in what he is the kind connection string that we created already this month at the tables that we have in our OMS database and I m going to select customer and orders his time and living in a customer orders data set is doing now is generate a set of classes for a data set and it s contained the tables noticed now that we ve got customer orders data set with customer and orders in Sosa to do is read in a drop the customer table onto a form by default if we distract us over it will create a grid of customers we denigrate you want details see in drop down and select details and now we drag us over it will create a control
Minute 2

For every single field in the customer table and we got seem to assume he did not a drop some components down here for us including an IDE navigator which allows us to scroll through the records inside our customer table as well as buttons for adding deleting and updating our data cement actually want to do is add the orders so we scroll through each of the customers here who want to make sure only displaying the orders for that customer so you want to add the related orders so what we need to do is expand the customer here and it will see the related orders under that it s very important to distinguish between the relation here and the orders he if we chopped just this orders table onto the form we will get fat automatic filtering in the orders as we scrapped our customers to run in the sky and drop it onto the form and now we ve got a grade of orders
Minute 3

Are getting to my property sheet and we re going to anchor this data grid view and its snake the form look little bit better here in the book so that I so the next thing we need to do here is what I go into your code and what we want to do is make sure that we are also seeking our order table so I m just an ad copy these two lines of code and so when we click save will Oxley have the order saying as well in his changes to orders as well okay seat orders and retail
Minute 4

A great and still be fully ready to test says we re many need to set this form as the startup form for a project as we have one here already some in this clinical double click on my project and he will make it in this here and now you can see startup form in earnest in the select forum tale in case and I was ready to test this feeling I have found the OCR for him to starts here and I can scroll through the two records that I have in my database and as you notice you can see the orders below filtering as we scroll to the customers so these are the orders that are related to the customer and so it will change some things make my full name here and let s add in order
Minute 5

And was a shift on okay and I say if an updated our data they do look like it works so that s all it takes to get a one to many data entry form to gather all we did was a use the data sources window to connect to a database and create an customer orders data set with customers and related orders in their will so I d like to thank you for your time if you like to check out the Visual Basic developer Center will be posting updates these videos there please also check out the Visual Basic team blog and my blog for more information basic and

No comments: