J
James Chambers
Ok, I have been beating my head against the monitor now for weeks. My
family no longer recognizes me and I am hearing tales about Uncle Bob
coming to visit even. This can't be this hard. I have a significant
amount of experience programming with VB 4 and 5. That, of course, was
about 6 years ago before I moved into infrastructure support. I bought
a Hauppauge PVR 150 and quickly decided I wanted functionality similar
to my Tivo in that when I enter shows, it will record them whenever they
are on. XMLTV provides listings in XML format. I thought it was a good
reason to dip back into my programming skills. After all, XML is the
big buzz word. I went out and bought VB .Net and here I am.
Here's what I am trying to do... I want to read in the XML Schema and
Data, assign it to a Dataset bound to a DataGrid. From there, I want to
be able to select items based on the title_Text field of the title table
and display the results into a DataGrid. I do OK until I try to display
the results. When I do, I only get the results of the titles table, not
the related data. Below, I'll post the relevant code... As always, any
help appreciated.
Public Class Form1
Inherits System.Windows.Forms.Form
Dim dsXMLTV As New DataSet("xmltv")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Load dataset with file from XMLTV
dsXMLTV.ReadXmlSchema("c:\xmltv\tv.xml")
dsXMLTV.ReadXml("c:\xmltv\tv.xml")
' Using DataGrid, display data from dataset
With DataGrid1
.DataSource = dsXMLTV.DefaultViewManager
.DataMember = "programme"
.CaptionText = .DataMember
End With
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSearch.Click
' Search for Monster Garage as a test
With dsXMLTV.Tables("title")
.DefaultView.RowFilter = "title_Text like 'Monster Garage'"
If .DefaultView.Count = 0 Then
MessageBox.Show("No matching rows.", "Alert",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
DataGrid1.DataSource = .DefaultView
' When this is executed, all I get is a list of titles.
End With
End Sub
End Class
family no longer recognizes me and I am hearing tales about Uncle Bob
coming to visit even. This can't be this hard. I have a significant
amount of experience programming with VB 4 and 5. That, of course, was
about 6 years ago before I moved into infrastructure support. I bought
a Hauppauge PVR 150 and quickly decided I wanted functionality similar
to my Tivo in that when I enter shows, it will record them whenever they
are on. XMLTV provides listings in XML format. I thought it was a good
reason to dip back into my programming skills. After all, XML is the
big buzz word. I went out and bought VB .Net and here I am.
Here's what I am trying to do... I want to read in the XML Schema and
Data, assign it to a Dataset bound to a DataGrid. From there, I want to
be able to select items based on the title_Text field of the title table
and display the results into a DataGrid. I do OK until I try to display
the results. When I do, I only get the results of the titles table, not
the related data. Below, I'll post the relevant code... As always, any
help appreciated.
Public Class Form1
Inherits System.Windows.Forms.Form
Dim dsXMLTV As New DataSet("xmltv")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Load dataset with file from XMLTV
dsXMLTV.ReadXmlSchema("c:\xmltv\tv.xml")
dsXMLTV.ReadXml("c:\xmltv\tv.xml")
' Using DataGrid, display data from dataset
With DataGrid1
.DataSource = dsXMLTV.DefaultViewManager
.DataMember = "programme"
.CaptionText = .DataMember
End With
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSearch.Click
' Search for Monster Garage as a test
With dsXMLTV.Tables("title")
.DefaultView.RowFilter = "title_Text like 'Monster Garage'"
If .DefaultView.Count = 0 Then
MessageBox.Show("No matching rows.", "Alert",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
DataGrid1.DataSource = .DefaultView
' When this is executed, all I get is a list of titles.
End With
End Sub
End Class