Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Auto Complete textbox

Auto Complete textbox

Scheduled Pinned Locked Moved ASP.NET
help
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Balwinder_singh
    wrote on last edited by
    #1

    I am trying to run this for auto complete. Everything is working fine, but getting error Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray :laugh: Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String() Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") ' Return matching movies Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray End Function Please suggest what needs to be corrected.

    N 1 Reply Last reply
    0
    • B Balwinder_singh

      I am trying to run this for auto complete. Everything is working fine, but getting error Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray :laugh: Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String() Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") ' Return matching movies Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray End Function Please suggest what needs to be corrected.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Do you think telling us what error you are getting might be helpful? :rolleyes:


      I know the language. I've read a book. - _Madmatt

      B 1 Reply Last reply
      0
      • N Not Active

        Do you think telling us what error you are getting might be helpful? :rolleyes:


        I know the language. I've read a book. - _Madmatt

        B Offline
        B Offline
        Balwinder_singh
        wrote on last edited by
        #3

        Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30198: ')' expected. Source Error: Line 76: Line 77: Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String() Line 78: Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") Line 79: ' Return matching movies Line 80: Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray Source File: C:\Documents and Settings\balwinder_singh\My Documents\Visual Studio 2008\WebSites\correction\Default.aspx.vb Line: 78 This is the error I am getting .

        B 1 Reply Last reply
        0
        • B Balwinder_singh

          Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30198: ')' expected. Source Error: Line 76: Line 77: Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String() Line 78: Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") Line 79: ' Return matching movies Line 80: Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray Source File: C:\Documents and Settings\balwinder_singh\My Documents\Visual Studio 2008\WebSites\correction\Default.aspx.vb Line: 78 This is the error I am getting .

          B Offline
          B Offline
          Balwinder_singh
          wrote on last edited by
          #4

          Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30198: ')' expected. Source Error: Line 76: Line 77: Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String() Line 78: Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") Line 79: ' Return matching country Line 80: Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray Source File: C:\Documents and Settings\balwinder_singh\My Documents\Visual Studio 2008\WebSites\correction\Default.aspx.vb Line: 78 Made some changes still no clue about error.

          P 1 Reply Last reply
          0
          • B Balwinder_singh

            Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30198: ')' expected. Source Error: Line 76: Line 77: Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String() Line 78: Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") Line 79: ' Return matching country Line 80: Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray Source File: C:\Documents and Settings\balwinder_singh\My Documents\Visual Studio 2008\WebSites\correction\Default.aspx.vb Line: 78 Made some changes still no clue about error.

            P Offline
            P Offline
            Paladin2000
            wrote on last edited by
            #5

            Maybe this?

            Dim country() As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore")

            B 1 Reply Last reply
            0
            • P Paladin2000

              Maybe this?

              Dim country() As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore")

              B Offline
              B Offline
              Balwinder_singh
              wrote on last edited by
              #6

              I have tried this also still the same. I have added the script manager and the autocomplete to the textbox. The command is actually to auto suggest when the enduser types alphabet. Say in case he types ind the webpage should suggest India Indonesia. I think there is some problem with the command used below but couldnt figure out what needs to be changed. Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") ' Return matching country Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray

              P P 2 Replies Last reply
              0
              • B Balwinder_singh

                I have tried this also still the same. I have added the script manager and the autocomplete to the textbox. The command is actually to auto suggest when the enduser types alphabet. Say in case he types ind the webpage should suggest India Indonesia. I think there is some problem with the command used below but couldnt figure out what needs to be changed. Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") ' Return matching country Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray

                P Offline
                P Offline
                Paladin2000
                wrote on last edited by
                #7

                Didn't see it in the copy/paste, but your country array also is using parenthesis instead of curly-braces...

                Dim country() As String = {"India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore"}

                P 1 Reply Last reply
                0
                • P Paladin2000

                  Didn't see it in the copy/paste, but your country array also is using parenthesis instead of curly-braces...

                  Dim country() As String = {"India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore"}

                  P Offline
                  P Offline
                  Paladin2000
                  wrote on last edited by
                  #8

                  Perhaps you were wanting something like this?

                  Module Module1

                  Sub Main()
                      Console.WriteLine(getCountry("In"))
                      Console.Read()
                  End Sub
                  
                  Function getCountry(ByVal prefixText As String)
                      Dim country() As String = {"India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore"}
                      ' Return matching country 
                      Return (From m In country Where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m).First()
                  End Function
                  

                  End Module

                  1 Reply Last reply
                  0
                  • B Balwinder_singh

                    I have tried this also still the same. I have added the script manager and the autocomplete to the textbox. The command is actually to auto suggest when the enduser types alphabet. Say in case he types ind the webpage should suggest India Indonesia. I think there is some problem with the command used below but couldnt figure out what needs to be changed. Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore") ' Return matching country Return From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m Take (count).ToString.ToCharArray

                    P Offline
                    P Offline
                    PunkIsNotDead
                    wrote on last edited by
                    #9

                    Try using the auto complete with a web Method! adding up of the function

                    <WebMethod()>
                    Public Function blabla(ByVal prefixText As String, ByVal count As Integer) As List<String>
                    Dim country As String = ("India", "UK", "Indonesia", "Japan", "Sri Lanka", "Singapore")
                    Dim Qry = (From m In country Where m.ToString.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) Select m).Take(count)
                    Return Qry.ToList
                    End Function

                    I don't remember 100% Vb but it may work :) good luck and don't forget the

                    ServiceMethod="blabla"
                    ServicePath="MyPage.aspx"

                    in the Extender

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups