CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    datatable.select user functions

    I've defined a function:

    Public Class GeneralFunctions
    Function StartsWith(ByVal sStart As String, ByVal sWord As String) As Boolean
    Return Strings.Left(sWord, Len(sStart)).Equals(sStart)
    End Function
    End Class

    Trying:
    dim a = dt.Select("StartsWith(IssuerName,'abc')")

    yields a runtime error: The expression contains undefined function call StartsWith()


    Thinking is was a user defined issue I also tried:
    dim a = dt.Select("Strings.Left(IssuerName, 1).Equals('B')"

    and got: The expression contains undefined function call Strings.Left()

    How are functions used in the filter expression of Datatable.Select?

    thx

  2. #2
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    Re: datatable.select user functions

    found it:

    ". . . use the same rules that apply to the DataColumn class's Expression property . . ."

    http://msdn.microsoft.com/en-us/libr...xpression.aspx

    dim a = dt.Select("IssuerName LIKE 'B*'")

    worked

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts



HTML5 Development Center

Click Here to Expand Forum to Full Width