We help IT Professionals succeed at work.
Get Started

Help with retreiving text data with concatenate method

vcharles asked
Last Modified: 2012-06-21

I've made some progress with the code below, but I'm running into two issuse.

1. The value retrieved from the controls is for example c1Receiver.text insatead of the actual values displayed

2. The prgram only saves data to the last xml file in the string (i.e. Receiver.xml), but I need to save the text values of the controls to all the xml files that are part of curXYZ.

How do I solve those two issues?  
Dim xyz() As String = New String() {"Manufacturer", "Receiver"}
        Dim i As Integer
        i = 0
        For i = 0 To 1
            Dim curXYZ = xyz(i)
            Dim MyFix As XDocument = XDocument.Load(Server.MapPath("~/App_Data/" & curXYZ & ".xml"))
            Dim xid As String
            xid = curXYZ & "_ID"
            Dim LargestFixID = (From el In MyFix.Descendants(curXYZ & "Table") Select CInt(el.<xid>.Value)).ToList
            Dim xtable As String
            xtable = curXYZ & "Table"
            Dim xcontrol1 As String
            xcontrol1 = "Me.C1" & curXYZ & ".Text"
            Dim xcontrol As String
            xcontrol = "Me.C1" & curXYZ & ".Text.ToString"

            Dim CheckForItemFix = (From el In MyFix.Descendants(xtable).Elements(curXYZ) Select el.Value).ToList
            If Not CheckForItemFix.Contains(xcontrol1) Then
                Dim xNew As XElement = New XElement(xtable)
                xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
                xNew.Add(New XElement(curXYZ, xcontrol1))
                MyFix.Save(Server.MapPath("~/App_Data/" & curXYZ & ".xml"))
            End If

            Dim searchFix As String = xcontrol1
            Dim searchIdFix As String = Nothing
            Dim domFix As New XmlDocument()
            domFix.Load(Server.MapPath("~/App_Data/" & curXYZ & ".xml"))
            Dim listFix As XmlNodeList = domFix.SelectNodes("//" & xtable)
            If CheckForItemFix.Contains(xcontrol1) Then
                For Each node As XmlNode In listFix
                    If node(curXYZ).InnerText.Equals(searchFix) Then
                        searchIdFix = node(xid).InnerText
                        Exit For
                    End If
            End If

Open in new window


Watch Question
Senior software engineer
This problem has been solved!
Unlock 1 Answer and 22 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE