Hi!

I'm using VS 2003 and MS Access. I have this Form1 that displays Record details on textboxes (they are databinded).. The records are retrieved from MS Access using the code:

Public Sub loadFund()
        '[Load  Items]
        Dim selectAllSQL as string = "SELECT * FROM Table1"
        Dim selectAllCMD As OleDbCommand = New OleDbCommand(selectAllSQL, theConnection)
        theAdapter.SelectCommand = selectAllCMD

        theData = New DataSet
        theAdapter.Fill(theData, "Table1")
        '[Load  Items /]
    End Sub

I have a search function that will show a datagrid on the lower part of the form. So far I was able to filter searches using this code.

Dim dv As New DataView(theData.Tables("Table1"))
        dv.RowFilter = "itmAmt = " & "'" & txtSearch.Text & "'"
        DataGrid1.DataSource = dv

The filter works fine, but I have one problem. The main form (that contains the record details)does not navigate along when I navigate thru the datagrid. I want to be able to do that. So when the user finds what he's looking for from the filtered results, he could just double click on the datagrid row and the row that was double clicked would show on the main form so he could edit it or something using the main form. How is this possible? Please help me, its driving me crazy. :(

Recommended Answers

All 5 Replies

on datagrid double click event, get data on selected then show it on main form.

thanks for replying. I already found a solution. I filtered the result from another grid and when the user double click one of the results, it will select the corresponding row on my main grid that is databinded on my main form. :)

very good. Would you like to share with us how to do it, so if other members get the same problem they can solved it.
And don't forget to mark this thread as solved..
Thanks :)

Sure, :)

I had two datagrids. One (datagrid1) was binded on my main form and the other (datagrid2) I used to filer. After filter, the user should double click a row from the results from datagrid2 and it will automatically select the corresponding row from datagrid1. :)

Using this code on my datagird2_doubleclick

Dim _id As Integer
        Dim i As Integer
        _id = datagrid2(datagrid2.CurrentRowIndex, 0).ToString()

        For i = 0 To cFT.theData.Tables("tbl1").Rows.Count - 1
            datagrid1.UnSelect(i)
            If datagrid1(i, 0).ToString = _id Then
                datagrid1.Select(i)
               datagrid1.ScrollToRow(i)
                datagrid2.Visible = False
            End If
        Next

        datagrid1.Focus()

Thx For sharing... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.