Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6084351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:30:41+00:00 2026-05-23T11:30:41+00:00

I am building a predicate in VB.net using the PredicateBuilder class from the LinqKit

  • 0

I am building a predicate in VB.net using the PredicateBuilder class from the LinqKit library.
My datasource is a manually constructed datatable.
All the examples I’ve found show folks creating the predicate and then passing that predicate as an argument to the Where() method on the datatable.AsEnumerable().

But intellisense is telling me that the Where() method takes a paremeter of type “System.Func“, but the type returned by PredicateBuilder is “System.Linq.Expressions.Expression(Of Func(Of T, Boolean))“

What am I missing?

Example:

        Dim ds As DataTable = getData()

        Dim tmp As IEnumerable(Of DataRow) = New DataTable().AsEnumerable()

        ' CREATE DYNAMIC LINQ WHERE CLAUSE
        Dim predicate As System.Linq.Expressions.Expression(Of Func(Of DataRow, Boolean)) = PredicateBuilder.True(Of DataRow)()

        If cbHPMS_ShowRequired.Checked Then
            predicate = predicate.And(Function(x As DataRow) x("RECORD_TYPE") = "REQUIRED")
        End If
        If cbHPMS_ShowOptional.Checked Then
            predicate = predicate.And(Function(x As DataRow) x("RECORD_TYPE") = "OPTIONAL")
        End If
        If cbHPMS_EmptyRecord.Checked Then
            predicate = predicate.And(Function(x As DataRow) x("RECORD_STATUS") = "EMPTY")
        End If
        If cbHPMS_PartialRecord.Checked Then
            predicate = predicate.And(Function(x As DataRow) x("RECORD_STATUS") = "PARTIAL")
        End If
        If cbHPMS_CompletedRecord.Checked Then
            predicate = predicate.And(Function(x As DataRow) x("RECORD_STATUS") = "COMPLETE")
        End If
        If Not String.IsNullOrEmpty(ddHPMS_RoadName.SelectedValue) And Not ddHPMS_RoadName.SelectedValue.Equals("Select") Then
            predicate = predicate.And(Function(x As DataRow) x("RoadName") = ddHPMS_RoadName.SelectedValue)
        End If

        tmp = ds.AsEnumerable().Where(predicate)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:30:42+00:00Added an answer on May 23, 2026 at 11:30 am

    I have not used LinqKit but would think it would be like

    tmp = ds.AsEnumerable().Where(predicate.Compile())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building my query using PredicateBuilder from LinqKit. it is great and does
I'm using .NET 3.5 In my DataLayer class I have references of System.Core,System.Data.Linq, System.Data.DataSetExtensions.
Building on from a previous query regarding Class::Struct vs Object::Accessor, I'd like to find
building a site using PHP and MySQL that needs to store a lot of
Building a new ASP.net application, and planning to separate DB, 'service' tier and Web/UI
I am building a pretty complex predicate in several iterations, and want to supply
I'm building a NSPredicate using the code below for an iPhone app. The logging
We are currently building a mid-sized intranet application using MVC3. One requirement is the
Building from source outside of macports is a breeze. Building with macports takes forever
Building a test web service and all was working great, so I added the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.