Please help get this msdn function working to create an auto complete method

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-05-26T10:24:25Z Indexed on 2010/05/26 10:31 UTC
Read the original article Hit count: 308

Filed under:
|
|
|
|

Here is a method from msdn to provide data to an autocomplete extender / textbox:

  <System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()> _
    Public Shared Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
        ' Create array of movies
        Dim movies() As String = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"}

        ' Return matching movies
        Return From m In movies(6) Where _
               (m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase))
        Select m).Take(count).ToArray()

    End Function

The errors are:

m.StartsWith - ('Startswith' is not a member of 'Char')

Select m - ('Select Case' must end with a matching end select)

.Take(count).ToArray() - (End of statement expected)

Can you please let me know how to get this function working? Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net