Link to home
Start Free TrialLog in
Avatar of djp12345
djp12345

asked on

Filtering Data in a datagridview using visual studio 2005 (vb.net) help for a newbie

I am below a novice at this so the easier the explaination and steps the better. I am creating a vb .net form using visual studio 2005. I created a datagridview (datagridview1) that attaches to my erp database as readonly (ms sql2000). The grid contains a query (code not shown) that populates information correctly. From there I created a combo box that will filter the data in the grid (see code). The problem that I have is when I filter the data, it will show me all the records in the grid for that PO and what I want to do is be able to filter records based on multiple criteria. As an example I select the PO in my combobox. It returns all records based that PO. Now what would like to do is create two text boxes (unbound I'm guessing) and filter the grid further based on a date in my grid called Receiver_Date. So I would select a PO from my first combbox(record filter) then put in the through and from dates. The other issue I am have is currently in my Receiver_Date field on the grid the returned records currently show up as date time (ex: 12/29/2008 11:40 am) I just want the date to show up with out the time and cannot find where to do this. Sorry if I rambled. I hope my explaination makes sense. Also please let me know if there is anything else I need to watch out for.
'Filter Data by PO
If ComboBox1.SelectedIndex > 0 Then
            Me.POIBindingSource.Filter = "PO_Name = '" & ComboBox1.SelectedValue.ToString & "'"
            Me.POIBindingSource.Sort = "PO_Name, Item_Name, Purchase_Order_ID"
            Me.POITableAdapter.Fill(Me.IERP81_TMADataSet.POI)
        End If
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial