diff --git a/guinget/MainWindow.resx b/guinget/MainWindow.resx index d56c25a6..83819245 100644 --- a/guinget/MainWindow.resx +++ b/guinget/MainWindow.resx @@ -123,9 +123,6 @@ 357, 17 - - No package is selected or the package list hasn't been loaded yet. You can load the package list by using the Refresh cache toolbar button, by going to Package list>Refresh cache, or by pressing Ctrl+R. - True @@ -147,6 +144,9 @@ True + + No package is selected or the package list hasn't been loaded yet. You can load the package list by using the Refresh cache toolbar button, by going to Package list>Refresh cache, or by pressing Ctrl+R. + 153, 17 diff --git a/guinget/MainWindow.vb b/guinget/MainWindow.vb index 7038b7c8..72270340 100644 --- a/guinget/MainWindow.vb +++ b/guinget/MainWindow.vb @@ -695,14 +695,26 @@ Public Class aaformMainWindow ' Update main window. aaformMainWindow.Update() + Dim SearchTerm As String = aaformMainWindow.toolstriptextboxSearch.Text + For Each searchRow As DataGridViewRow In aaformMainWindow.datagridviewPackageList.Rows ' Look in each row in the datagridview, and see what text it has. - If searchRow.Cells.Item(2).Value.ToString.ToLowerInvariant.Contains(aaformMainWindow.toolstriptextboxSearch.Text.ToLowerInvariant) Then - ' If the Package ID cell contains what's in the search box, show it. - searchRow.Visible = True - Else - ' Otherwise, hide it. - searchRow.Visible = False + ' If it starts and ends with double-quotes, remove them and do an exact match. + If SearchTerm.ToLowerInvariant.StartsWith("""") AndAlso SearchTerm.ToLowerInvariant.EndsWith("""") Then + ' Set all rows visible to what's in the search box without the start and end. + If searchRow.Cells.Item(2).Value.ToString.ToLowerInvariant = SearchTerm.ToLowerInvariant.Trim(CChar("""")) Then + ' Set only exactly-matching rows to show. + searchRow.Visible = True + Else + ' Otherwise, hide it. + searchRow.Visible = False + End If + ElseIf searchRow.Cells.Item(2).Value.ToString.ToLowerInvariant.Contains(SearchTerm.ToLowerInvariant) Then + ' If the Package ID cell contains what's in the search box, show it. + searchRow.Visible = True + Else + ' Otherwise, hide it. + searchRow.Visible = False End If ' Make the progress bar progress. aaformMainWindow.toolstripprogressbarLoadingPackages.PerformStep()