| | |
help with filter on datagrid
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2006
Posts: 4
Reputation:
Solved Threads: 0
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:
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.
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.
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:
VB.NET Syntax (Toggle Plain Text)
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.
VB.NET Syntax (Toggle Plain Text)
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.
Last edited by cynical; Jan 24th, 2009 at 8:51 am.
on datagrid double click event, get data on selected then show it on main form.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
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
And don't forget to mark this thread as solved..
Thanks
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Nov 2006
Posts: 4
Reputation:
Solved Threads: 0
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
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
VB.NET Syntax (Toggle Plain Text)
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()
Last edited by cynical; Jan 26th, 2009 at 8:51 pm.
Thx For sharing...
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Similar Threads
- how to write a query to sum a field, and to filter the records to date selected (Visual Basic 4 / 5 / 6)
- Highlight the data in the DataGrid when it is searched... (C#)
- New textbox in user control broke datagrid sorting (ASP.NET)
- update the db using values in a datagrid (VB.NET)
- Open ASCII file in Datagrid (VB.NET)
- using summation and aggregate expressions on datagrid/view (ASP.NET)
- search in datagrid (C#)
- It's all about datagrid (VB.NET)
- filter recordset with checkbox using SQL (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: How to start with VB.net
- Next Thread: How to connect vb.net in the internet?
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey table temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year






