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.
hi beth, how can i set the row header pointer of a datagridview to a particular position. i wil elaborate.i hav a search form in which 1 datagridview is there.i am binding the datagridview with all records in the database in page load.
1 textbox is also there in which i wil give the search text.when ever the text is changing the row header pointer should point to that row in which that search text is there and in ascendung order
Use the bindingsource to set the position and set the datasource of the Datagridview to the bindingsource. Take a look at this video here: http://msdn2.microsoft.com/en-us/vbasic/bb725824.aspx
Thanks, a lot messi, i have watched ur binding navigator videos. i hav implemented like that also.but 1 doubt. how to update the binding navigator and controls from other page .means from a page other than the page in which the binding navigator is there.also in the same page to update the binding navigator and controls i hav used me.custtableadaptor.fill(me.custdataset.cust).is that the correct way to update the navigator.i dont know nuts,i am using this navigator for the first time.and wen i used the same thru instance from other page it is not working. please give some solution for this bye take care
Take a look at this article: http://blogs.msdn.com/bethmassi/archive/2007/10/01/using-data-across-multiple-windows-forms.aspx
You may also want to check out the VB support forums for more info: http://forums.microsoft.com/msdn/default.aspx?forumgroupid=10&siteid=1
Thanks for the response. I think it is great that you take the time to help people. As I said I have been following along with your forms over data series I have learned a great deal. I have created a database using the method shown in your video. Lets say in the database you created in your video you have a date field that is allowed to be null. How do you supply a null as a parameter for your update method? I have tried many things but have not had any success. I changed the date fields to string and am able to send an empty string but I worry this would affect being able to search the database based on dates.
Also, are you doing any more videos in the near future?
hi beth i am fed up with this navigator. look beth i am implementing my navigator in 1 page.i hav kept some fields like fname,lname,cid in comboboxtoolstrip.after selecting 1 field wen i click on search button 1 other page over the main page should open with all records in the grid.and the row header pointer should be in the record which was the current record in the navigator.also wen i select the row in grid,that row should come in the backwindow ie the mainform.also how to put data from more than 2 tables in datagridview.
Did you look at the sample application attached to this post?
Have you tried using System.DBNull?
ya loaded the sample application.the diference is that i just want to make the particular record selected from the second page's grid as the current record in the main page.i dont want to change any data and all. also i want to fill the grid in search page with records from 3 tables.but the main thing is that how to make the grid's current record as the navigators curent record
I've got one more question for you. How can I update two data tables in the same form using single datanavigator?
If you're using VS 2005 then check out this video: http://msdn2.microsoft.com/en-us/vbasic/bb725826.aspx and these articles: http://blogs.msdn.com/bethmassi/archive/2007/07/10/working-with-tableadapters-related-datatables-and-transactions.aspx and http://blogs.msdn.com/bethmassi/archive/2007/07/11/tableadapters-and-transactions.aspx
If you're using VS 2008 then just call the UpdateAll method of the TableAdapterManager.
i have used your multiform sample .its is marvellous.
but got one problem that is after i updated the data in the second form,i have used the end edit method.hence the datagrid in the first form is updated.inorder to save the changes in the database am using your save method in the binding navigator save item click .but it is giving the error ie.'update requires a valid update command when passed datarow collection with modified rows'.
I am very much impressed by your style of explaining Data related issues. I have learned a lot from ur series "Form over data". So far we have mastered what u have told us. One thing which i thought could make our life easier is that if you could relase a video regarding passing information b/w multiple forms. For example if we have an orders form and we have a customerID Field which is no doubt a forigen key and link to customerID in Customer Table. So on our order form we have one button control "Search Customer" and when we click that button it open another form "Search Customer" and on that form we have a search box and list control when we type our query in search box it will show the possible match for the customer name. and then we will double click one customer (one item of list box) then search form will go out and our order form active again with the CustomerID field filled with the customer which we selected previously. Our customer search form could be a tabbed form with multiple tabes. We could search by Name, Area, TelNo. etc. I hope you will consider this request and sooner we will have a video explaining the technique to achieve similar goals.
Thankx in advance
You'll need to supply an update command on your table adapters in order to update records properly. ALso if you add or delete rows, the InsertCommand and DeleteCommand will also need to be specified. Just open the DataSet designer and select on the tableadapters and specify the commands in the properties window.