|
-
Nov 10th, 2021, 03:55 AM
#1
Thread Starter
Junior Member
Datagridview - Search and filter particular column(s) only
Apologies if this has been answered in a similar post, I did check but could not find a solution to my specific problem.
I have a form, button, datagridview, textbox.
DataGridview has 5 columns already added to it, but no data. The data is being pulled from a .CSV and then populating the datagridview.
- Actor Name
- Movie Name
- Year Released
- Movie Rating
- Review Score
I'm currently pulling the data by using the command button (code) as below.
Code:
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
DataGridView1.Rows.Clear()
Dim TextFieldParser1 As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\Data\VB.net\Actors.csv")
TextFieldParser1.Delimiters = New String() {","}
While Not TextFieldParser1.EndOfData
Dim Row1 As String() = TextFieldParser1.ReadFields()
DataGridView1.Rows.Add(Row1)
End While
End Sub
I want to search within a particular column and only show the data relevant. For example I want to find all the movies released in 2020, the datagrid shows me that. I don't want to search all the columns matching 2020, I only want to focus on the column "Year Released" and retrieve that information. Eventually I'm going to have a range of multiple actors names as well as movie release dates to search and retrieve data. I want to start nice and easy so that I can understand this further.
Can anyone assist or advise ?
Many thanks!
Last edited by dday9; Nov 10th, 2021 at 11:21 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|