Results 1 to 5 of 5

Thread: [RESOLVED] [2005] Another XML Query

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    9

    Resolved [RESOLVED] [2005] Another XML Query

    Hi Guys,

    I have an XML file
    Code:
    <DVDInfo>
      <DVD>
        <DVDTitle>The Exorcist</DVDTitle>
        <Director>William Friedkin</Director>
        <Cast>Linda Blair</Cast>
        <Description>Horror</Description>
        <Rating>18</Rating>
        <Cost>7.99</Cost>
        <Copies>0</Copies>
        <Rental>0</Rental>
        <Image>Exorcist.jpeg</Image>
      </DVD>
      <DVD>
        <DVDTitle>The Matrix</DVDTitle>
        <Director>Wachowski</Director>
        <Cast>Keanu Reaves</Cast>
        <Description>Action</Description>
        <Rating>15</Rating>
        <Cost>7.99</Cost>
        <Copies>20</Copies>
        <Rental>0</Rental>
        <Image>Matrix.jpeg</Image>
      </DVD>
    I need a way to search the XML file for a DVDTitle the title I want it to find is held within a textbox, and ammend the <copies> +1 and <rental> -1 nods when I click on a button .

    Heres the vb code I've got so far, the code was ammended from nmadd's thread

    http://www.vbforums.com/showthread.php?t=478692

    The vb code I have is the following:
    Code:
    Dim xd As New XmlDocumen
    Dim nod As XmlNode =  xd.SelectSingleNode("/DVDInfo/DVD/DVDTitle"(Me.DVD_Title.text))
    
    xd.Load("C:\Documents and Settings\Huw Friedhoff\Desktop\Project Interface9\Project interface\DVD.xml")
    
            If Me.CopiesTextBlock.Text = "0" Then
                MessageBox.Show("No copies available for Rent")
    
            ElseIf nod IsNot Nothing Then
    
                nod.ChildNodes(5).InnerText = nod.ChildNodes(5).Innertext - 1
                nod.Childnodes(6).InnerText = nod.ChildNodes(6).Innertext + 1
            Else
                Messagebox.show("Could not find the DVD you requested")
    
            End If
            xd.Save("C:\Documents and Settings\Huw Friedhoff\Desktop\Project Interface9\Project interface\DVD.xml")
            MessageBox.Show("Changes have been made to the file")
    I dont know how to tell to get the dvd title from the textbox, the current line I have is

    Code:
    Dim nod As XmlNode =  xd.SelectSingleNode("/DVDInfo/DVD/DVDTitle"(Me.DVD_Title.text))

    Any help would be appriciated,

    Rusty.
    Last edited by Rustyfuture; Apr 13th, 2008 at 05:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width