Click here to Skip to main content
16,020,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I AM USING THIS CODE TO DATAGRID VIEW BUT ITS CUASES AN ERROR PLEASE HELP ME TO SOLVE THIS ERROR OCCURRED ON THIS
VB
ivate Sub Btn_Show_Click(sender As Object, e As RoutedEventArgs)
        Dim conString As String = "Data Source=SHAHRUKH-PC\SQLEXPRESS;Initial Catalog=SOUL20DB;User ID=sa;Password=sa@1234"
        Dim conn As SqlConnection = New SqlConnection(conString)
        Dim adap As New SqlDataAdapter
        Dim sqlCmd As SqlCommand
        Dim sqlResult As Object
        Dim BibliDS As New DataSet
        Dim TitleDS As New DataSet

        Dim Table As New DataTable
        Dim directory As Directory = FSDirectory.GetDirectory("C:\Users\Shahrukh\Documents\Visual Studio 2012\Projects\Simple search1\Simple search1\New folder")
        Dim analyzer As Lucene.Net.Analysis.Analyzer = New SimpleAnalyzer()
        Dim parser = New QueryParser("Title", analyzer)

        parser.SetDefaultOperator(QueryParser.Operator.AND)
        Dim query As Lucene.Net.Search.Query = parser.Parse("Title:" & txtSearch.Text)
        Dim searcher = New IndexSearcher(directory)

        Dim hits As Hits = searcher.Search(query)
        Dim results As Integer = hits.Length
        Console.WriteLine("Found {0} results", results)

        For i As Integer = 0 To results - 1

            Dim doc As Document = hits.Doc(i)
            Dim score = hits.Score(i)
            adap.Fill(TitleDS)
            dGridResults.ItemsSource = TitleDS.tables[0];HERE ERROR COMES
Posted

The syntax in the statement looks like C# but your code is VB, try the following
VB
dGridResults.ItemsSource = TitleDS.Tables(0)
 
Share this answer
 
Comments
Member 11835578 20-Sep-15 3:28am    
thanks man
Wendelius 20-Sep-15 3:37am    
You're welcome.
Make sure you have a component by the name dGridResults in the form.
 
Share this answer
 
Comments
Member 11835578 20-Sep-15 0:32am    
YA I HAVE IT XAML CODE
Member 11835578 20-Sep-15 0:32am    
I DECLARE THAT IN XAML CODE
Abhinav S 20-Sep-15 0:35am    
Try removing and adding it again. Sometimes xaml does not reflect data properly.
Member 11835578 20-Sep-15 1:10am    
i have try this but still the error occurred
Member 11835578 20-Sep-15 1:12am    
in code i am try to bind a data into grid from lucene index serch query so can u tell the proper way to bind a data in to grid from lucene index or lucene query parser as shown in code

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