|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Doing some extra task while saving databind Controls in VB.Net 2005 ?I have created a form using Data Sources in VB.Net 2005, and Binding
Navigator, even I did not write a single line of code and data is displaying, saving, deleting perfectly with the click of buttons on Binding Navigator. Now, what I want, that if the user clicks on the Save Button of Binding Navigator, one field of that table should be saved with Current Date and Time. Do I need to use BuyerBindingSource, BuyerTableAdapter or dsBuyer (typed dataset). How can I do so? Any example will be highly appreciated. Best Regards, Luqman Hi,
You can get the current datarow this way Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductsBindingNavigatorSaveItem.Click Me.Validate() Me.ProductsBindingSource.EndEdit() Dim dr As DataRow = Me.Inventory_Control1DataSet.Products.Item(Me.ProductsBindingSource.CurrencyManager.Position) MessageBox.Show(dr.Item(0).ToString) 'Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) End Sub Ken ---------------- Show quoteHide quote "Luqman" <pearls***@cyber.net.pk> wrote in message news:%233qZGMqUGHA.5148@TK2MSFTNGP12.phx.gbl... >I have created a form using Data Sources in VB.Net 2005, and Binding >Navigator, even I did not write a single line of code and data is >displaying, saving, deleting perfectly with the click of buttons on Binding >Navigator. > > Now, what I want, that if the user clicks on the Save Button of Binding > Navigator, one field of that table should be saved with Current Date and > Time. > > Do I need to use BuyerBindingSource, BuyerTableAdapter or dsBuyer (typed > dataset). > > How can I do so? Any example will be highly appreciated. > > Best Regards, > > Luqman > > > > > You can also use the new (in 2005) Current property
Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductsBindingNavigatorSaveItem.Click if Me.ProductsBindingSource.Current Is Nothing Then Exit Sub Me.Validate() Me.ProductsBindingSource.EndEdit() Dim dr As DataRow = CType(Me.ProductsBindingSource.Current, DataRow) MessageBox.Show(dr.Item(0).ToString) 'Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) End Sub Show quoteHide quote "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:uHeWp9rUGHA.1688@TK2MSFTNGP11.phx.gbl... > Hi, > > You can get the current datarow this way > > Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As > System.Object, ByVal e As System.EventArgs) Handles > ProductsBindingNavigatorSaveItem.Click > > Me.Validate() > > Me.ProductsBindingSource.EndEdit() > > Dim dr As DataRow = > Me.Inventory_Control1DataSet.Products.Item(Me.ProductsBindingSource.CurrencyManager.Position) > > MessageBox.Show(dr.Item(0).ToString) > > 'Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) > > End Sub > > > > Ken > > ---------------- > > "Luqman" <pearls***@cyber.net.pk> wrote in message > news:%233qZGMqUGHA.5148@TK2MSFTNGP12.phx.gbl... >>I have created a form using Data Sources in VB.Net 2005, and Binding >>Navigator, even I did not write a single line of code and data is >>displaying, saving, deleting perfectly with the click of buttons on >>Binding Navigator. >> >> Now, what I want, that if the user clicks on the Save Button of Binding >> Navigator, one field of that table should be saved with Current Date and >> Time. >> >> Do I need to use BuyerBindingSource, BuyerTableAdapter or dsBuyer (typed >> dataset). >> >> How can I do so? Any example will be highly appreciated. >> >> Best Regards, >> >> Luqman >> >> >> >> >> > > Hi,
Ok, I understood, is it possible to use Field Names with Data Row. for example: Dim dr As DataRow = CType(Me.ProductsBindingSource.Current, DataRow) dr.ProductID=123 dr.ProductName="ABC" Me.ProductsBindingSource.EndEdit() Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) Best Regards, Luqman Show quoteHide quote "Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message Me.Inventory_Control1DataSet.Products.Item(Me.ProductsBindingSource.Currencynews:OdRjoOvUGHA.1572@tk2msftngp13.phx.gbl... > You can also use the new (in 2005) Current property > > Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As > System.Object, ByVal e As System.EventArgs) Handles > ProductsBindingNavigatorSaveItem.Click > > if Me.ProductsBindingSource.Current Is Nothing Then Exit Sub > > Me.Validate() > > Me.ProductsBindingSource.EndEdit() > > Dim dr As DataRow = CType(Me.ProductsBindingSource.Current, DataRow) > > MessageBox.Show(dr.Item(0).ToString) > > 'Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) > > End Sub > > > > "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message > news:uHeWp9rUGHA.1688@TK2MSFTNGP11.phx.gbl... > > Hi, > > > > You can get the current datarow this way > > > > Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As > > System.Object, ByVal e As System.EventArgs) Handles > > ProductsBindingNavigatorSaveItem.Click > > > > Me.Validate() > > > > Me.ProductsBindingSource.EndEdit() > > > > Dim dr As DataRow = > > Manager.Position) Show quoteHide quote > > > > MessageBox.Show(dr.Item(0).ToString) > > > > 'Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) > > > > End Sub > > > > > > > > Ken > > > > ---------------- > > > > "Luqman" <pearls***@cyber.net.pk> wrote in message > > news:%233qZGMqUGHA.5148@TK2MSFTNGP12.phx.gbl... > >>I have created a form using Data Sources in VB.Net 2005, and Binding > >>Navigator, even I did not write a single line of code and data is > >>displaying, saving, deleting perfectly with the click of buttons on > >>Binding Navigator. > >> > >> Now, what I want, that if the user clicks on the Save Button of Binding > >> Navigator, one field of that table should be saved with Current Date and > >> Time. > >> > >> Do I need to use BuyerBindingSource, BuyerTableAdapter or dsBuyer (typed > >> dataset). > >> > >> How can I do so? Any example will be highly appreciated. > >> > >> Best Regards, > >> > >> Luqman > >> > >> > >> > >> > >> > > > > > > Yes, if you use a "Typed DataSet" instead of a generic DataRow.
Show quoteHide quote "Luqman" <pearls***@cyber.net.pk> wrote in message news:OFxYYVwUGHA.4248@TK2MSFTNGP10.phx.gbl... > Hi, > > Ok, I understood, is it possible to use Field Names with Data Row. > > for example: > > Dim dr As DataRow = CType(Me.ProductsBindingSource.Current, DataRow) > dr.ProductID=123 > dr.ProductName="ABC" > Me.ProductsBindingSource.EndEdit() > Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) > > Best Regards, > > Luqman > > > > > > "Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message > news:OdRjoOvUGHA.1572@tk2msftngp13.phx.gbl... >> You can also use the new (in 2005) Current property >> >> Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As >> System.Object, ByVal e As System.EventArgs) Handles >> ProductsBindingNavigatorSaveItem.Click >> >> if Me.ProductsBindingSource.Current Is Nothing Then Exit Sub >> >> Me.Validate() >> >> Me.ProductsBindingSource.EndEdit() >> >> Dim dr As DataRow = CType(Me.ProductsBindingSource.Current, DataRow) >> >> MessageBox.Show(dr.Item(0).ToString) >> >> 'Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) >> >> End Sub >> >> >> >> "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message >> news:uHeWp9rUGHA.1688@TK2MSFTNGP11.phx.gbl... >> > Hi, >> > >> > You can get the current datarow this way >> > >> > Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As >> > System.Object, ByVal e As System.EventArgs) Handles >> > ProductsBindingNavigatorSaveItem.Click >> > >> > Me.Validate() >> > >> > Me.ProductsBindingSource.EndEdit() >> > >> > Dim dr As DataRow = >> > > Me.Inventory_Control1DataSet.Products.Item(Me.ProductsBindingSource.Currency > Manager.Position) >> > >> > MessageBox.Show(dr.Item(0).ToString) >> > >> > 'Me.ProductsTableAdapter.Update(Me.Inventory_Control1DataSet.Products) >> > >> > End Sub >> > >> > >> > >> > Ken >> > >> > ---------------- >> > >> > "Luqman" <pearls***@cyber.net.pk> wrote in message >> > news:%233qZGMqUGHA.5148@TK2MSFTNGP12.phx.gbl... >> >>I have created a form using Data Sources in VB.Net 2005, and Binding >> >>Navigator, even I did not write a single line of code and data is >> >>displaying, saving, deleting perfectly with the click of buttons on >> >>Binding Navigator. >> >> >> >> Now, what I want, that if the user clicks on the Save Button of >> >> Binding >> >> Navigator, one field of that table should be saved with Current Date > and >> >> Time. >> >> >> >> Do I need to use BuyerBindingSource, BuyerTableAdapter or dsBuyer > (typed >> >> dataset). >> >> >> >> How can I do so? Any example will be highly appreciated. >> >> >> >> Best Regards, >> >> >> >> Luqman >> >> >> >> >> >> >> >> >> >> >> > >> > >> >> > > |
|||||||||||||||||||||||