Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using a dll called SearchBox.dll which will search across web sites using MSNWebService and return me the results.



http://www.asp.net/community/control-gallery/Item.aspx?i=1419

i want to use this in a web service.

here is my code


using ControlFreak;
[WebMethod(EnableSession = true)]
public void CallWebService()
{
try
{

SearchBox objSB = new SearchBox();
objSB.SearchProvider = SearchBox.SearchProviderEnum.MSNWebService;

objSB.ShowSearchOptions = false;
objSB.SearchSite = "www.dell.com";
objSB.SearchSiteOnly = true;
objSB.Search("laptop");
objSB.SearchResultsReady += new SearchBox.SearchResultsReadyEventHandler(objSB_SearchResultsReady);
}

catch (Exception ex)
{
string str = ex.Message;
}


}

void objSB_SearchResultsReady(DataTable SearchResults)
{
DataTable dt = new DataTable();
dt = SearchResults;
}


Can somebody please tell me how to raise the event objSB_SearchResultsReady

thanks in advance
Posted

1 solution

Normally this would not be a problem, just call .Invoke on the Event, however I see you are using a non standard eventhandler. All eventhandlers should inherit from System.EventHandler and should handle arguments that inherit from System.EventArgs. In fact that would mean you can use the Generics EventHandler<t> and not write your own class.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900