This posting is provided "AS IS" with no warranties, and confers no rights.
blah blah blah
You have two options there...
You can use the Query.SearchDesktop class and the ExecuteQuery method, or you can use the wrapper class "SampleWrapper.QueryBuilder" by including QueryBuilder.cs in your project. It shouldn't matter that it's CSharp and you're using VB, that's part of the beauty of .NET ![]()
The QueryBuilder class should give you IntelliSense support and make working with the API a little easier.
Otherwise, to use the COM interface, try this:
Open VS 2003 and create a new VB.NET "Windows Forms" project. Add a reference to WDSQuery.dll.
Drop a DataGrid control from the toolbox onto the form, and size it reasonably. Leave the name as "DataGrid1" for now.
Copy and paste this code into the vb file:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mSearchClass As New Microsoft.Windows.DesktopSearch.Query.SearchDesktopClass
Dim resultSet As Microsoft.Windows.DesktopSearch.Query._Recordset
resultSet = mSearchClass.ExecuteQuery("test", "DocTitle,DocAuthor,Url", "DocTitle", Nothing)
Dim DataSet1 As New System.Data.DataSet
Dim DataTable1 As New System.Data.DataTable
DataSet1.Tables.Add(DataTable1)
Dim DataAdapter1 As New System.Data.OleDb.OleDbDataAdapter
DataAdapter1.Fill(DataTable1, resultSet)
DataGrid1.DataSource = DataSet1
DataGrid1.DataMember = "Table1"
End Sub
Build and run. Your datagrid should be filled with results for the query "test" - you can of course change that to something more pertinent to your index.
VB isn't really my thing, but that works on my system and should give you a basic idea of how to use the COM interfaces.
Watch my blog, I'll do a post for VB developers today or tomorrow. I don't have internet access at my new place til tomorrow morning... that's why I haven't been able to post much ![]()
Aqua-Soft Forums