Go Premium for a chance to win a PS4. Enter to Win


Navigating dataset.tables.rows

Posted on 2004-09-27
Medium Priority
Last Modified: 2008-01-09

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


Question by:adwat

Accepted Solution

KGreg earned 672 total points
ID: 12163871
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,

LVL 10

Assisted Solution

123654789987 earned 664 total points
ID: 12166823
look at the following link. It gives a clear description of using Binding context


Assisted Solution

wguerram earned 664 total points
ID: 12169629

'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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question