"DATABASE" DATAVIEW GRID

Here's the first part of my code:
Private Sub frmCust_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim oledbDA As System.Data.OleDb.OleDbDataAdapter
        Dim oleFillComm As System.Data.OleDb.OleDbCommand
        Dim oleUpdComm As System.Data.OleDb.OleDbCommand
        Dim oleDS As DataSet
        Dim oleBS As BindingSource

        oleFillComm = New System.Data.OleDb.OleDbCommand
        oleUpdComm = New System.Data.OleDb.OleDbCommand
        oleDS = New DataSet

        oleconn = New System.Data.OleDb.OleDbConnection
        oledbDA = New System.Data.OleDb.OleDbDataAdapter
        oleconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source=C:\ShopHand\ShopHand\ShopHand\slspro.mdb;" & _
            "Persist Security Info=True"
        oleconn.Open()

        oleFillComm.Connection = oleconn
        oleFillComm.CommandText = "SELECT         LastName, FirstName, MiddleInitial, Address1, Address2, City, State, Zip, " & _
        "WorkPhone, CellPhone, HomePhone, Fax, EmailAddress, IsEmployee, Notes, PayrollDeduction, SocialSecurity, " & _
        "Deals.LocalLenderAppID, Deals.FundingStatus, Deals.FundingDate, Deals.LastWriteCount " & _ 
"FROM            ((Customers INNER JOIN " & _
                         "Stock ON Customers.CustomerID = Stock.PurchasedFrom) INNER JOIN " & _
                         "Deals ON Stock.InventoryID = Deals.VehicleSold) " & _
"ORDER BY Customers.LastName"

        oledbDA.SelectCommand = oleFillComm
        oledbDA.Fill(oleDS)

        Me.DataGridView1.DataSource = oleDS.Tables(0)

    End Sub

Open in new window


The above code loads a "datagridview1" from a database by way of a dataset (oleDS) which works fine.

    Public Function FindCust(ByVal CustText As String) As Boolean

        Dim TypeOfForm As String = "r"
        Dim IsOpened As Boolean = False
        Dim cform As frmCust = Nothing

        Call Get_Custform(cform)

        Call SeeIfFormHasAnInstanceOpened(TypeOfForm, IsOpened)
        If IsOpened = True Then
        Else
            MessageBox.Show("Customer Form Not Opened - OPEN FORM", "Form Not Opened", MessageBoxButtons.OK)
            FindCust = False
            Return FindCust
            Exit Function
        End If

        cform.DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect

        Dim intcount As Integer = 0
        Dim CellToLookIn As Integer = 0
        Dim rowindex As String = Nothing

        cform.lblTxtToFind.Visible = False
        If IsNothing(cform.cboFind.SelectedItem) Then
        Else
            If cform.cboFind.SelectedItem = "Last Name" Then
                CellToLookIn = 0
            Else
                CellToLookIn = 15
            End If
        End If

        cform.DataGridView1.AllowUserToAddRows = False
        For Each row As DataGridViewRow In cform.DataGridView1.Rows
            If cform.DataGridView1.Rows(intcount).Cells(CellToLookIn).Value.ToString = CustText Then
                cform.DataGridView1.Rows(intcount).Selected = True
                FindCust = True
                Exit Function
            End If
            intcount = intcount + 1
        Next
        cform.DataGridView1.AllowUserToAddRows = True
        FindCust = False
        Return FindCust
    End Function

Open in new window


the above code is a procedure getting called when the customer searches the data for a "Last Name" or "VIN" of a dataset record
which also works fine - I guess my ? is - When the data is  found I need a way for the screen to go to the (SELECTED RECORD) like a bindingsource so I can call the .MOVENEXT method as the code loops through the data and I don't know now to make a binding source in code! Could someone help me?
MBHEY131Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MBHEY131Author Commented:
I found the answer:

Dim TargetRow as integer = 0
TargetRow = cform.DataGridView1.SelectedRows(0).Index
                cform.DataGridView1.FirstDisplayedScrollingRowIndex = TargetRow
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

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.