How to use Binding Navogator with DataSet and/or DataView object? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to use Binding Navogator with DataSet and/or DataView object?

mabilalmirzamabilalmirza Posts: 12Member
I retrieved records in DataSet object and got a table in DataView object from the DataSet object. I bound Text boxes with DataView object. Everything is working correctly.

But now I want to use Binding Navigator object to navigate between records of DataView object. How can I use it?

One way is to use Wizard, but I don't want to use wizard.

I have following controls on the form "frmCategories"

[b]BindingNavigator[/b]: bnvProducts
[b]TextBox[/b]: txtProductTypeID
[b]TextBox[/b]: txtProductTypeName

I have the following coding

Imports System.Data
Imports System.Data.SqlClient
Public Class frmCategories

'Query String
Dim strQuery As String = "SELECT * from Product_Type"

'Sql Objects
Dim objConnetion As New SqlConnection("Data Source=.;Initial Catalog=BE;Integrated Security=True")
Dim objDataAdapter As New SqlDataAdapter(strQuery, objConnetion)

Dim objDataSet As DataSet
Dim objDataView As DataView
Private Sub FillDataSetAndView()

objDataSet = New DataSet

'Fill Data Set
objDataAdapter.Fill(objDataSet, "Product_Type")

'Getting ProductType table from DataSet in DataView
objDataView = New DataView(objDataSet.Tables("Product_Type"))

End Sub
Private Sub BindFields()

'Clear all previous DataBindings

'Bind to DataView object
txtProductTypeID.DataBindings.Add("Text", objDataView, "Product_Type_id")
txtProductTypeName.DataBindings.Add("Text", objDataView, "Product_Type_Name")

End Sub
Private Sub frmCategories_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'Fill Data

'Bind Fields

End Sub

End Class
Sign In or Register to comment.