get content from xml and show it in a lable

Welcome Forums General PowerShell Q&A get content from xml and show it in a lable

Viewing 1 reply thread
  • Author
    Posts
    • #251606
      Participant
      Topics: 2
      Replies: 2
      Points: 34
      Rank: Member

      Hello all,
      I’m very new in powershell and this are my first stepps and hope someone could help me.

      I get a content from a xml file. The displayname from it is loaded into a combox and this is working. What i try to do now is, if i choose “Street” in the combobox in another lable the “streetAddress” should be show. Here’s the code i have until now. The line “$label1.Text = ????????” is where i don’t know to solve :-).

      thanks in advance

       

       

      Here’s the xml:
      <Exchange>
      <attribut ID=”1″>
      <displayName>Office</displayName>
      <exchangeName>Office</exchangeName>
      </attribut>
      <attribut ID=”2″>
      <displayName>Street</displayName>
      <exchangeName>streetAddress</exchangeName>
      </attribut>
      <attribut ID=”3″>
      <displayName>City</displayName>
      <exchangeName>City</exchangeName>
      </attribut>
      </Exchange

    • #251648
      Participant
      Topics: 15
      Replies: 1776
      Points: 3,218
      Helping Hand
      Rank: Community Hero

      The XML code should be:

      This is writing the output to the host, not saving to a variable:

      As far as the label, you need to create an event for the combobox:

      This would trigger when anything is changed in the comboxbox, do something. The next issue you are going to run into is scope. If you are trying to get additional information from the XML based on the select item, then you need to ensure that it’s available to the entire script:

      Then in your Combobox event something like:

      This is a bit advanced as a beginner project as you are working with .NET, Powershell, etc., but there are lots of examples posted out there on forms. None of the items I posted are tested, just pseudo code to get you in the right direction.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.