Im pretty sure im just tired but I think I need some help.
I have an xml file called "QuotesxmlDoc", in my program I have written code for a search screen that searches the xml file for titles or keywords in quotes saved and the information is then shown in a datagridview, please see the code below:
Private Sub btnSearchQoutes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchQoutes.Click
Dim xmlnav As XPathNavigator
Dim xmlitr As XPathNodeIterator
Dim speaker As String
Dim line As String
Dim dt As New DataTable()
Dim dr As DataRow
Dim i As Integer
DataGridView1.DataSource = New DataView(dt)
If loaded Then
xmlnav = QuotesxmlDoc.CreateNavigator()
xmlitr = xmlnav.Select("//LINE[contains(.,""" & txtBoxSearch.Text & """)]/..")
dt.Columns.Add("Author", GetType(String))
dt.Columns.Add("Line", GetType(String))
While (xmlitr.MoveNext())
Dim nav2 As Xml.XPath.XPathNavigator = xmlitr.Current.Clone
nav2.MoveToFirstChild()
speaker = nav2.Value
i = 0
While nav2.MoveToNext()
line = nav2.Value
dr = dt.NewRow
If (i = 0) Then
dr(0) = speaker
Else
dr(0) = ""
End If
dr(1) = line
dt.Rows.Add(dr)
i = i + 1
End While
DataGridView1.DataSource = New DataView(dt)
End While
End If
End Sub
End Class
On the main screen of the program, I want to show all the saved quotes from the xml file in a datagridview, I just need to show the date, category, author, title of the quotes, I also need the datagridview to refresh everytime a new quote is saved.
Im pretty sure I can use some of the above code to do this but I need a bit of help with it.
Cheers
John

New Topic/Question
Reply




MultiQuote




|