vbMarkO Posted July 25, 2006 Posted July 25, 2006 (edited) I am a Pastor and I am writing a Church membership addressbook using xml as my database.... What I have at the moment is this... I have a Datagridview of which I can read and edit and save back to the xml file. However, I am not really a fan of the DataGrid view at least for my address book. So, I have created a form that has Labels and textboxes on it of which I can display the specifc members names and any data related to them within these textboxes. But what I havent found via online or here yet is how I might edit that information displayed in the textboxes and save it back to my xml file like I can in the datagridview. Here is an example of my xml file structure... <?xml version="1.0" standalone="yes"?> <ChurchMembership> <Members> <Mem_T>1</Mem_T> <Name> Smith, John</Name> <Email>me@me.com</Email> </Members> <Members> <Mem_T>2</Mem_T> <Name> Doe, John</Name> <Email>You@me.com</Email> </Members> </ChurchMembership> This is an example of the simular structure of my actual xml file though the names were changed to protect the innocent.... hehe anyone just hear Dragnet music.. Anyway, I can Parse my xml file which contains 50 or so names instead of just 2 as above... and display them in textboxes and labels for some of the info. Using my DataGrid I can add new Tables and fields or edit any fields as seen above.... such as name or email and and such like. But How can I edit the xml file with the textboxes instead of the DataGrid? Here is a code example of how I am getting the info to textboxes.... Sub DisplayMember(ByVal Posistion As Integer) Dim node As XmlNode = xmlDoc.SelectSingleNode( _ "/ChurchMemberShip/Members[" & Posistion & "]") Dim intRN As Integer = node.SelectSingleNode("Mem_T").InnerText Dim strName As String = node.SelectSingleNode("Name").InnerText 'Dim strLname As String = node.SelectSingleNode("Last_Name").InnerText 'Dim strFname As String = node.SelectSingleNode("First_Name").InnerText Dim strPhone As String = node.SelectSingleNode("Phone").InnerText Dim strAddress As String = node.SelectSingleNode("Address").InnerText Dim strCity As String = node.SelectSingleNode("City").InnerText Dim strState As String = node.SelectSingleNode("State").InnerText Dim strZip As String = node.SelectSingleNode("Zip").InnerText Dim strVisit As String = node.SelectSingleNode("Visit_Dates").InnerText Dim strNotes As String = node.SelectSingleNode("Notes").InnerText lblName.Text = strName lblPhone.Text = strPhone txtName.Text = strName 'txtLastName.Text = strLname 'txtFirstName.Text = strFname txtPhone.Text = strPhone txtAddress.Text = strAddress cboCity.Text = strCity txtState.Text = strState txtZip.Text = strZip If Not (strVisit Is Nothing) Then lstDates.Items.Add(strVisit) End If txtNote.Text = strNotes lblRNum.Text = intRN End Sub Private Sub lstNames_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstNames.SelectedIndexChanged lstDates.Items.Clear() DisplayMember(lstNames.SelectedIndex + 1) End Sub This adds all the names to a listbox of which as I am using arrow keys to move up and down the list it automatically adds the info from the xml file to the textboxes and labels.... But this brings me to why I started this thread.... How can I create an edit button that would allow me to update.... using the textboxes not the datagridview? I have searched all over and have not found an example that would deal with a singlenode using a textbox and then update the existing xml file... PLease help vbMarkO Edited July 25, 2006 by vbMarkO Quote Visual Basic 2008 Express Edition!
vbMarkO Posted July 26, 2006 Author Posted July 26, 2006 RESOLVED I figured out how to edit the displayed data that is within the Textboxes. It was in fact quite easy well... once I figured it out, finding out was long and tiresome. vbMarKO Quote Visual Basic 2008 Express Edition!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.