It seems as if the author forgot to reference how the above mentioned controls should be used in the code.
The code below has been tested and it works, if you have any issues, please contact me on zlatan.dzinic@bcx.co.za
First make sure that your project has the following list of referrences:
Microsoft.Office.Server
Microsoft.Office.Server.Search
Microsoft.SharePoint
System
System.Data
System.Drawing
System.Web
System.Xml
Here's a suggested way (not sure what he/she needed a label for):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.Office.Server;
using Microsoft.Office.Server.Search.Query;
namespace DeleteMeWindowsApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdQuery_Click(object sender, EventArgs e)
{
//The string containing the keyword to use in the search
string keywordString = txtQuery.Text;
//The XML string containing the query request information
//for the Web service
string qXMLString = "<QueryPacket xmlns='urn:Microsoft.Search.Query'>" +
"<Query><SupportedFormats><Format revision='1'>" +
"urn:Microsoft.Search.Response.Document:Document</Format>" +
"</SupportedFormats><Context><QueryText language='en-US' type='STRING'>" +
keywordString +
"</QueryText></Context></Query></QueryPacket>";
QueryWebServiceProxy.QueryService queryService = new QueryWebServiceProxy.QueryService();
queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Data.DataSet queryResults = queryService.QueryEx(qXMLString);
grdResults.DataSource = queryResults.Tables[0];
}
}
}