Sharing the goodness…
Beth Massi is a Senior Program Manager on the Visual Studio team at Microsoft and a community champion for business application developers. Learn more about Beth.
More videos »
I just released two more videos (#15, #16) in the Forms Over Data video series. One is on understanding data binding and how it works from database all the way to the controls you see on forms. We talk about the relationship between the TableAdapter, the BindingSource and the DataSet and I show how to work with data in your code.
The second one explains how to update related data tables like I explained in this post. This video doesn't go into how to set up the transactions but you can read about how to do that here. I've also attached the code from the videos here.
I am new to vb.net and I have almost the same problem as posted by Nyein Htoo above. Basically, I have an order screen in which I have the Order header in detail format in the upper portion of the screen. In the lower half of the screen, I have the OrderDetail in datagridview with itemnumber, quantities, unit of measures, etc. However, what I couldn't make it work is I want is to show the item description next to the item number right after the user enters it. I modified the SELECT statement in the tableadapter to reflect the join with the item table. It tested fine in the execute button in the configure menu. However, it ran into problem as soon as I ran the application.
Any help would be greatly appreciated. Thank you so much for the video series!
I seen "Create a search form" (#4 of your video series). It's as great as the other videos.
I want to use the code for two related tables in VB2008 (ie.: customer and orders). I set the relationship to "Both relation and foreign key constraint" and "Update" and "Delete" rules to cascade. In my form I show customer table in detail-mode and orders table in datagridview-mode.
In "CustomerTableAdapter" I create, with QueryBuilder, a search query (similar to your lastname query) and I write the following code:
Private Sub frmSearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CustomerOrdersDataSet.EnforceConstraints = False
Me.CustomerTableAdapter.FillByLastName(Me.CustomerOrdersDataSet.customer, "D") 'Lastname with first letter = D
Me.CustomerOrdersDataSet.EnforceConstraints = True
Without "EnforceConstraints" debugger generate error. With previous code the "EnforceConstraints=false" don't rise error, but "EnforceConstraints=true" rise a Constraint Exception.
So....I can't use your code for two tables (is it correct?). But, if I have two related tables, what's the correct way to obtain a search form?
Thanks in advance,
Hello Mesi, I need code for Master-Details Windows Form In Vb.net
When EnforceConstraints is True this means that for every child row in the child table there must be a cooresponding parent row in the parent table. You need to make sure that if you are only pulling the "D" customers that you also are only pulling the orders for those customers. It looks like you are pulling all the orders and this will cause the constraints to fail.
Take a look at this page for Winforms videos and associated code sample downloads: http://msdn.microsoft.com/en-us/vbasic/bb466226.aspx#formsoverdata
Specifically this one for Master-Details in VS 2008: http://msdn.microsoft.com/en-us/vbasic/cc138241.aspx
Thank for your video series, and We need you to continue in it, because we need more and more.
also if you show us how to we can make a look up table in datagrid view. i try to do that by using the drop down list and it work, but what if the look up table have a lot of data. especially now it have a delay when you click it to view.
thank you very much for your video series, especially in forms over data. i've learned a lot especially in databinding.
now, i'm beginning to create a simple application using vb 2005.
i have a question for you.
i have a two tables, ex.: student, registration
in Student Registration
LastName StudentID - foreign key
i did fill in data in both tables (but some students didn't have a level, i leave it blank), and i also did bind them, like what you did in video #16 and it work just fine..
now my question is this:
how can i display a student without a level? is this possible displaying in the way of making a query?
any help would be greatly appreciated..again thank you so much for the video series...a very big help to a beginner like me..
I want to learn vb.net Can you give the video about all of lesson
Hi G.K.M Piyangani,
All of the Visual Basic videos are here:
i want a complete code of datagridview manupulation, and flex grid also, +923014112602
I had the same problem as Liju. Something squashed the insert command in my table adapter. I did exactly as you said and recreated the insert command. For some strange reason, the query builder will not retain the full name of the table, i.e. [db].[owner].[table], so I'm the only one that can use the table. Any ideas as to why?
Hey Beth massi, thank you a lot for the wondeful information. Thanks a lot for all of them.
Thank you very much for your video's , you are the greatste.
Really you do good work , and i am greatful so much for you.
I Know that you have a littel time. but we need more tutorials, and make it against cost, but do make it expensive to us , take from me you have a fist customer.
But Beth we need a tutorials the useful are for the markt , i mean how we can make invoice , how we can make a purchase order on vb net , you know some doucument which are used in the company world.
Again you are the greatst. and i love so much
Can you please help me with code that inserts data in a child table that is on the next form in details view? And too, could you retrieve last entered data (for example ID) from the primary table?
Beth, in How Do I: Get Started with the DataGridView, you do not show how you transform the EmployeeID column to combobox. And is important!