Page 4 of 4

Re: XML data to a label.text property

Posted: Thu Feb 21, 2019 11:06 am
by jvierra
This is the variable you need to check: $BindingURL'

Code: Select all

$buttonSEARCH_Click= {
     [System.Windows.Forms.MessageBox]::Show($BindingURL')  # <==== get the value of the variable
     [xml]$file = (Get-Content 'c:\test\programdata\Server Configuration.xml')
     $detailsLBL.Text = $file.SelectSingleNode("//Instance[BindingHostName='$BindingURL']").Name
 } 

Re: XML data to a label.text property

Posted: Thu Feb 21, 2019 11:09 am
by jvierra
Please post the code that sets that variable? This variable ->>> $detailsLBL

Re: XML data to a label.text property

Posted: Thu Feb 21, 2019 11:48 am
by miketartaglia
jvierra wrote:
Thu Feb 21, 2019 11:09 am
Please post the code that sets that variable? This variable ->>> $detailsLBL
$buttonSEARCH_Click= {
#TODO: Place custom script here
[xml]$file = (Get-Content 'c:\test\programdata\Server Configuration.xml')
$detailsLBL.Text = ($file.SelectSingleNode("//Instance[BindingHostName='$BindingURL']").Name)

}

Re: XML data to a label.text property

Posted: Thu Feb 21, 2019 12:22 pm
by jvierra
Sorry I meant to ask for this variable $BindingURL.

Re: XML data to a label.text property

Posted: Thu Feb 21, 2019 12:35 pm
by miketartaglia
I don't know where that code is. What you are talking about is a text box Named BindingURL. I enter text in this box and I assumed that the variable is set then. Please correct me if I'm wrong.

Re: XML data to a label.text property

Posted: Thu Feb 21, 2019 1:11 pm
by jvierra
How can you not know where the code is? You wrote it didn't you.

It sounds to me like the variable is not a simple text variable. If it is the text box then it is an object. I posted twice telling you how to determine what you have. Please go back and address the posts you ignored. They outline how to determine the issue and how to fix it.

Re: XML data to a label.text property

Posted: Thu Feb 21, 2019 1:32 pm
by jvierra
Sorry for the short answer butI am in the middle of something.

A textbox has a property that gets the contents.

For instructions on how to use a textbox control see: https://info.sapien.com/index.php/guis/ ... ox-control

Re: XML data to a label.text property

Posted: Fri Feb 22, 2019 2:29 am
by jvierra
I had a couple of minutes to kill so here is an example form showing how to use my XML code to query from a textbox and update a control. It is very simple.

Re: XML data to a label.text property

Posted: Fri Feb 22, 2019 9:09 am
by miketartaglia
That made me see the light. The problem was with me not assigning the $BindingURL.text to a variable after the user clicked the search button. Now I remember how to do it. thanks for the guidance.