Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 707
  • Last Modified:

Navigating dataset.tables.rows


Sir I want to work with VB.Net without using controls for sqlconnection, sqladapter and dataset.  So I created all this objects through coding. and it is working fine.
I am using bindingcontext class for movenext,movelast etc.  I did not use datagrid.  All controls are text boxes. during the form load records will be displayed in the screen. I want to find some records in the existing dataset.table(0) and display that record in the screen. I can find the record in dataset.  But cannot nvagate to that record to display instead first record displayed in the screen during the form load.  total row count is available, but current row number is not  getting.  If it is available I can say bm.position = row number(bm is instance of Class).

Please Help me, remember I am not using datagrid


3 Solutions
You need to preload your dataset before you set the binding context..  try creating a procedure that fills it.. then set the binding context..

here is an example where I look for the 25th entry

    dim objDas as new DataSet

    Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.BindingContext(objdas, "myTable").Position = 25
    End Sub

I hope this helps you,

look at the following link. It gives a clear description of using Binding context

'You have to specify the column where you will search the value.

dataset.Tables(0).DefaultView.Sort = "KeyColumn"

bm.Position = dataset.Tables(0).DefaultView.Find("ValueToSearch") 'Returns the row index
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now