AutoComplete TextBox
-
HI all I am trying to create a autocomplete textbox i used this code The code in c# it is working fine but when i convert to VB it is giving error . :) on page load() " acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData)" can any one tell me what i am missing in the code. MY CODE -------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData) End Sub _ Public Function GetSearchData(ByVal s As String) As System.Data.DataTable Dim conn As New SqlConnection("server=DSS1;uid=sa;pwd=sa;database=Northwind") Dim cmd As New SqlCommand("SELECT FirstName FROM Employees WHERE FirstName LIKE @FirstName + '%'", conn) cmd.Parameters.Add("@FirstName", s) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd da.Fill(ds, "Employee") Return ds.Tables("Employee") End Function ----------------- Keerthi
-
HI all I am trying to create a autocomplete textbox i used this code The code in c# it is working fine but when i convert to VB it is giving error . :) on page load() " acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData)" can any one tell me what i am missing in the code. MY CODE -------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData) End Sub _ Public Function GetSearchData(ByVal s As String) As System.Data.DataTable Dim conn As New SqlConnection("server=DSS1;uid=sa;pwd=sa;database=Northwind") Dim cmd As New SqlCommand("SELECT FirstName FROM Employees WHERE FirstName LIKE @FirstName + '%'", conn) cmd.Parameters.Add("@FirstName", s) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd da.Fill(ds, "Employee") Return ds.Tables("Employee") End Function ----------------- Keerthi
What error are you getting?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
-
What error are you getting?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
Thx For reply The Error is C:\Inetpub\wwwroot\20-3-2006\TextBoxAutoCompletion\WebForm1.aspx.vb(31): 'WebCustomControl.Lab.Autocomplete.AutoCompleteHandler' is a delegate type. Delegate construction permits only a single AddressOf expression as an argument list. Often an AddressOf expression can be used instead of a delegate construction. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData) End Sub Keerthi
-
Thx For reply The Error is C:\Inetpub\wwwroot\20-3-2006\TextBoxAutoCompletion\WebForm1.aspx.vb(31): 'WebCustomControl.Lab.Autocomplete.AutoCompleteHandler' is a delegate type. Delegate construction permits only a single AddressOf expression as an argument list. Often an AddressOf expression can be used instead of a delegate construction. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData) End Sub Keerthi
kirthikirthi wrote:
acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData)
acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(**AddressOf** Me.GetSearchData)
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
-
kirthikirthi wrote:
acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(Me.GetSearchData)
acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(**AddressOf** Me.GetSearchData)
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
Thx Michael Sync It working Keerthi