Binding an object to Listbox.SelectedItem

I have this code:
Binding ContactBinding = new Binding("Conversation");
        ContactBinding.Source = lstContacts.SelectedItem;
        BindingOperations.SetBinding(txtRecieve, TextBlock.TextProperty, ContactBinding);
Is there a way to set the ContactBinding.Source to the SelectedItem so that when SelectedItem is changed txtRecieve is going to get the new object?

>>Is there a way to set the ContactBinding.Source to the SelectedItem so that when SelectedItem is changed txtRecieve is going to get the new object?
You should bind the Text property of the TextBlock to the Conversation property of the SelectedItem of the ListBox:
Binding ContactBinding = new Binding("SelectedItem.Conversation") { Source = lstContacts };
BindingOperations.SetBinding(txtRecieve, TextBlock.TextProperty, ContactBinding);
Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

Similar Messages

  • Creating and Binding View Objects dynamically : Oracle Jdeveloper 11g

    Hello,
    We are trying to create and bind view objects dynamically to adf data visualization components.
    The view object is a result of multiple tables.
    We are using Oracle JDeveloper 11g Technical Preview. ( can't upgrade to TP2 or TP3 now).
    We have found this : http://radio.weblogs.com/0118231/stories/2003/07/15/creatingUpdateableMultientityViewObjectDefinitionsDynamically.html on our search for the same.
    The sample application however, is in 10g , hence required migration.
    Also, it was a standalone application with the TestClient.java having a main() method.
    Our requirement is for Web Application; we use Adf+jsf .
    Guidance of any sort is very much appreciated.
    Thanks in advance.
    -Anil Golla

    Hi,
    there also exist a forum for JDeveloper 11: JDeveloper and OC4J 11g Technology Preview
    What you are trying todo is not trivial because you need to not only dynamically create the VO, you would also dynamically need to create the binding meta data for it (assuming you use ADF). Not sure if the API to modify the binding is public, so posting it on the JDeveloper 11 forum bears a glimpse of hope for an answer
    In JDeveloper 10.1.3 you can't do this
    Frank

  • Properly binding an object to a custom component.

    I am apparently not doing this. What am I missing to properly
    bind an
    object from a repeater looping over an array of object to the
    custom
    component called in the repeater?
    <mx:Repeater
    id="dayCells"
    dataProvider="{days}"
    startingIndex="{weekRows.currentItem}"
    count="7">
    <mx:GridItem
    width="14%"
    borderColor="black"
    borderThickness="1"
    borderStyle="solid">
    <mx:Label
    text="{dayCells.currentItem.formatedDate}" />
    <ian:dayFormat2
    drawData="{dayCells.currentItem as drawDay}"
    test="{dayCells.currentItem.formatedDate}" />
    </mx:GridItem>
    </mx:Repeater>
    {days} is an array of drawDate.as objects returned with a
    remoteObject.
    I can correctly bind properties of these drawDate objects in
    the
    lable and the test property of the dayFormat2
    customComponent. But I
    can NOT correctly bind the entire object over to dayFormat2.
    What am I
    missing?
    My current version of dayFormat2.mxml, I have tried several
    alternatives
    for this file.
    ?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:Script>
    <![CDATA[
    import drawDay;
    //Define public variables
    [Bindable]
    public var drawData:drawDay;
    [Bindable]
    public var test:String;
    ]]>
    </mx:Script>
    <mx:DateFormatter id="dayNum" formatString="DD" />
    <mx:HBox
    backgroundColor="0x002649"
    width="100%"
    horizontalAlign="right">
    <mx:Label
    text="{test}"
    color="white" />
    <mx:HBox
    backgroundColor="0xAF1E2D"
    horizontalAlign="center">
    <mx:Label
    text="{dayNum.format(drawData.date)}"
    color="white" />
    </mx:HBox>
    </mx:HBox>
    <mx:Label text="foobar" />
    </mx:VBox>
    The first label bound to the test String works correctly. The
    second
    label bound to the drawData drawDay object date property does
    not work
    correctly.
    What is the proper way to bind this object?

    I have struggled with this all day and made no headway. The
    only
    strange thing I get is with this line:
    <mx:Label text="{dayCells.currentItem.toString()}" />
    outputs [object Object]
    Not the expected string from this drawDay.as function.
    // toString()
    public function toString():String
    return "Date: " + formatedDate;
    Ian Skinner wrote:
    > I am apparently not doing this. What am I missing to
    properly bind an
    > object from a repeater looping over an array of object
    to the custom
    > component called in the repeater?
    >
    > <mx:Repeater
    > id="dayCells"
    > dataProvider="{days}"
    > startingIndex="{weekRows.currentItem}"
    > count="7">
    > <mx:GridItem
    > width="14%"
    > borderColor="black"
    > borderThickness="1"
    > borderStyle="solid">
    > <mx:Label
    > text="{dayCells.currentItem.formatedDate}" />
    > <ian:dayFormat2
    > drawData="{dayCells.currentItem as drawDay}"
    > test="{dayCells.currentItem.formatedDate}" />
    > </mx:GridItem>
    > </mx:Repeater>
    >
    > {days} is an array of drawDate.as objects returned with
    a remoteObject.
    > I can correctly bind properties of these drawDate
    objects in the lable
    > and the test property of the dayFormat2 customComponent.
    But I can NOT
    > correctly bind the entire object over to dayFormat2.
    What am I missing?
    >
    > My current version of dayFormat2.mxml, I have tried
    several alternatives
    > for this file.
    >
    > ?xml version="1.0" encoding="utf-8"?>
    > <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    > <mx:Script>
    > <![CDATA[
    > import drawDay;
    >
    > //Define public variables
    > [Bindable]
    > public var drawData:drawDay;
    >
    > [Bindable]
    > public var test:String;
    > ]]>
    > </mx:Script>
    >
    > <mx:DateFormatter id="dayNum" formatString="DD" />
    >
    > <mx:HBox
    > backgroundColor="0x002649"
    > width="100%"
    > horizontalAlign="right">
    > <mx:Label
    > text="{test}"
    > color="white" />
    > <mx:HBox
    > backgroundColor="0xAF1E2D"
    > horizontalAlign="center">
    > <mx:Label
    > text="{dayNum.format(drawData.date)}"
    > color="white" />
    > </mx:HBox>
    > </mx:HBox>
    >
    > <mx:Label text="foobar" />
    > </mx:VBox>
    >
    > The first label bound to the test String works
    correctly. The second
    > label bound to the drawData drawDay object date property
    does not work
    > correctly.
    >
    > What is the proper way to bind this object?

  • Javax.naming.NameAlreadyBoundException: Failed to bind remote object

    I am getting an error while deploying wli-ejbs.ear file. This ear uses oracle thin drivers to connect to database. But while deploying i am receiving an error as below. Can anyone please help me to solve this problem?
    Deployer:149033]preparing application wli-ejbs on managed2_cvf01
    [Deployer:149033]preparing application wli-ejbs on managed1_cvf01
    [Deployer:149033]prepared application wli-ejbs on managed1_cvf01
    [Deployer:149033]prepared application wli-ejbs on managed2_cvf01
    [Deployer:149033]activating application wli-ejbs on managed1_cvf01
    [Deployer:149033]activating application wli-ejbs on managed2_cvf01
    [Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application wli-ejbs on cvf01_cluster.: weblogic.management.DeploymentException:
    Exception:weblogic.management.ApplicationException: activate failed for calendar/oracle
    Module: calendar/oracle Error: Exception activating module: EJBModule(calendar/oracle,status=PREPARED)
    Unable to deploy EJB: RemoteCalendarBean from calendar/oracle:
    [EJB:011008]Unable to bind EJB Home Interface to the JNDI name: RemoteCalendarBean.
    javax.naming.NameAlreadyBoundException: Failed to bind remote object (ClusterableRemoteRef(704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01 null)/948 [com.bea.wli.calendar.api.BusinessCalendarHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]) to replica aware stub at RemoteCalendarBean(ClusterableRemoteRef(704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01 [704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01/944, -8505871579836432025S:172.24.206.163:[7005,7005,7006,7006,7005,7006,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed2_cvf01/1008])/944 [com.bea.wli.calendar.api.BusinessCalendarHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]); remaining name ''
    at weblogic.rmi.cluster.ClusterableRemoteObject.onBind(ClusterableRemoteObject.java:177)
    at weblogic.jndi.internal.BasicNamingNode.bindHere(BasicNamingNode.java:347)
    at weblogic.jndi.internal.ServerNamingNode.bindHere(ServerNamingNode.java:124)
    at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:291)
    at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:279)
    at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:386)
    at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:1141)
    at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1385)
    at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:631)
    at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3315)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2194)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2167)
    at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2503)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2421)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2138)
    at weblogic.management.deploy.slave.SlaveDeployer.commitUpdate(SlaveDeployer.java:676)
    at weblogic.drs.internal.SlaveCallbackHandler$2.execute(SlaveCallbackHandler.java:35)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

    run the sync.bat file as mentioned in the instructions...
    or through EBCC(select sampleportal-project dir, app name "sampleportal")...
    good luck
    Vijay
    "ellen" <[email protected]> wrote:
    >
    I installed sampleportal and did all the changes according to the documents,
    when
    the server started, there is this error:
    Unable to deploy EJB: CatalogWebService from catalogwe.jar:
    Unable to bind EJB Home Interface to the JNDI name: sampleportal.BEA_commerce.CatalogWebService.
    The error was: javax.naming.nameAlreadyBoundException: Failed to bind remote
    object...to
    replica aware stub at CatalogWebService; remaining name'sampleportal.BEA_commerce'
    After the server started with the above error, I tried to run the app, here
    is what
    occured:
    PortalPersistenceManager: portal'sampleportal/sampleportal' not found.
    Has anybody seen this before?
    Ellen

  • Using JNDI to bind any object

    Hi,
    I intend to bind a few objects in JNDI context so that they can later be just looked up and then used.
    I can use code like this:
    =========
    Hashtable env = new Hashtable();
    env.put(Context.PROVIDER_URL, SOME_PROVIDER_URL);
    env.put(Context.SECURITY_PRINCIPAL, "user");
    env.put(Context.SECURITY_CREDENTIAL, "passwd");
    Context ctx = new InitialContext(env);
    context.bind("name", object);
    =========
    This object can later be looked up. So far so good. However, this will bind the object in the same VM "only".
    Is there any way of calling something like:
    ====
    someOC4JClass.getNamingService().bind("name", object);
    ===
    so that the underlying naming service takes care of making this object available across JVMs?
    Any help/pointers will be highly appreciated.
    Thanks,
    Ravi

    Ravi -- Currently OC4J's internal JNDI is not a global JNDI shared by all OC4Js. One way to approach this problem would be to bind the objects in some global / common JNDI like OID.
    Thanks -- Jeff

  • Binding ActionScript object to webservice

    Hi,
    Can someone please provide me with simple example as to how
    to bind an ActionScript object to the webservice.
    The Scenario is I have an actionscript class. I have the
    webservice in the mail mxml. I want to create an object of the
    class and want to bind that object to the webservice rather than
    binding each of the property.
    Thanks in advance.

    Do not bind directly to a webService result. Use a result
    handler, and assign the result to a bindable variable. Bind to
    that.
    To intercept binding events in AS code, use a ChangeWatcher.
    Tracy

  • Binding an object

    Hi,
    Is it possible to bind an object to the thread and is so how.
    Thanks and Regards,
    Pradeep

    Although I have no idea of what you mean, I guess it have something to do with synchronized keyword or Object.wait() or event Thread.join().

  • Bind remote object to JNDI tree

    I want to create a JNDI tree in the same JVM with remote object, and then I have two problem:
    1> Should I bind remote object or its stub to the JNDI tree?
    2> How to look up the JNDI tree to get the binded stub from the client side? (Suppose server ip is 192.168.99.42)
    I hope a gentleman would give me a piece of code, so i would be much clearer. Thanks a lot!

    Hi,
    Refer http://java.sun.com/products/jndi/tutorial/objects/storing/remote.html
    -amol

  • Binding custom objects in weblogic JNDI

    I noticed that if I bind a custom object, the object is not available after the weblogic
    restart. Is there anyway to bind an object permanently in the weblogic JNDI..

    In article <[email protected]>, [email protected] says...
    Murali <[email protected]> wrote:
    I noticed that if I bind a custom object, the object is not available after the weblogic
    restart. Is there anyway to bind an object permanently in the weblogic JNDI..No.
    Perhaps what your trying to accomplish could be handled via a startup
    class that did the bind for you.
    Bob

  • Binding huge object to the jndi tree.

    Hi we are loading all the master tables in to objects at the app server startup (SUN ONE 7) and then binding the whole object to the jndi tree. All the tables data in text files comes to about 5 MB and the serilized object with data to about 8 MB. But when the app server tries to bind the object the app server process consumes over 500MB of ram and gives OutOfmemoryError as the total ram is 512MB. why is it consuming so much memory. It does bind an object of about 5 MB but when trying to lookup subsequent to the first lookup it fails. Is this a bug or what??? the same thing works perfectly with Weblogic and Websphere and also Weblogic is very efficient in memory consumption and response time is amazing. For a 5 MB object the lookup takes about 5Secs in Weblogic and about 15Mins in Sun One. We might have to drop the Sun One App Srv and go for Weblogic though we dont want. This same thing is working with about 4MB object in Sun One but takes about 45 Mins to 1 Hour to finish the serialization etc for jndi .Kindly provide some guidance.Thanks in advance.

    True. At the end I configured the value as a "server property". The cool thing about configuring the jndi tree is that it is replicated in a cluster.
    Obviously the values that I inserted affected all the applications, like the url of our SOA server.

  • Conflict start: You tried to bind an object under the name abc.Scheduler

    I have deployed my application on the WLS which is configured for clustred with 2 managed server and one admin server in the same machine. I see the below error on both of the managedServer consoles. can any one please help me resolving this issue.
    <Conflict start: You tried to bind an object under the name abc.Scheduler in the JNDI tree. The object from -2433108061996587758S:192.168.0.61:[7014,7014,-1,-1,-1,-1,-1]:SingleDomainClusterTake2:ManagedServer1 is non-clusterable, and you have tried to bind more than once from two or more servers. Such objects can only be deployed from one server.>
    Regards
    Suresh.

    Hi Jay,
    Below is the code snippet where I am binding the Schedular Object to a JNDI abc.Schedular and I got the above error message when I trying to deploy the application in clustered environment.
    Code Snippet where binding the Schedular Object
    private static final String JNDI_NAME = "abc/Scheduler";
    Hashtable ht=new Hashtable ();
    InitialContext context = new InitialContext();
    scheduler = new Scheduler();
    scheduler.setStorage(new DatabaseSchedulerStorage());
    context.bind(JNDI_NAME, scheduler);
    Code Snippet for looking up the schedular object
    protected Scheduler getScheduler() throws NamingException {
    if (scheduler != null) {
    return scheduler;
    Scheduler s=null;
    if(workaround){
    s=((ThreadManager)SchedulingServlet.getThreadManager()).getScheduler();
    }else{
    InitialContext context = new InitialContext();
    s = (Scheduler) context.lookup("reactor/Scheduler");
    if (s.getStorage() == null) {
    s.setStorage(new DatabaseSchedulerStorage());
    scheduler=s;
    return scheduler;
    I have added "ht.put(WLContext.REPLICATE_BINDINGS, "false");" to get rid of the conflict error but I what this object to be clustrable and you please let me know how do I make this object clustrable.
    I am using quartz schedular.
    Regards
    Suresh.

  • How to bind an object to JNDI tree in iAS?

    Hi all,
    When I try to bind a string object to jndi tree, the following exception
    occurs:
    javax.naming.NamingException: Unable to get object instance from reference.
    Roo
    t exception is javax.naming.NamingException: Can't bind instance of class
    java.lang.String
    at com.netscape.server.jndi.RootContext.bindCtx(Unknown Source)
    at com.netscape.server.jndi.RootContext.rebind(Unknown Source)
    at com.netscape.server.jndi.RootContext.rebind(Unknown Source)
    at javax.naming.InitialContext.rebind(InitialContext.java:385)
    at jsp.APPS.bmx.test2._jspService(test2.java:76)
    at jsp.APPS.bmx.test2.service(test2.java:42)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    The code fragment is:
    Context ctx = new InitialContext();
    String str = "hell,every one!";
    ctx.rebind("abc", str);
    Can anyone give some help? Thanks in advance.
    Johnson

    To bind an object into the JNDI tree check the documentation here:
    http://e-docs.bea.com/wls/docs81/jndi/jndi.html#475702
    If this is to be used by all your applications that you deploy on the server check out the startup/shutdown class documentation here:
    http://edocs.bea.com/wls/docs81/ConsoleHelp/startup_shutdown.html
    Cheers
    IV

  • Binding an object to a remote registry. Can it be done?

    I am having problems vending an object to a remote registry. Most of the examples that I have seen vend the object to a local registry which is not really what I need to do.
    I was trying to do:
    <PRE>
    Remote myObject = ...
    Registry r = LocateRegistry.getRegistry("someMachineOnTheNetwork");
    r.bind("rmi://mymachine/objectName", myObject);
    </PRE>
    This fails every time with an AccessException. It seems that the RMI registry only allows binding of objects that are local to it (I don't know of a way of enabling permissions for this. Seems reasonable to expect that not everyone should have the ability to register objects on any registry, but there must be a workaround.
    Any ideas?

    considering the security reasons the rules of the game is that registry must be in the same host as the probram doing the binding.
    So what is LocateRegistry for in that case? Basically it is to be noted that a getRegistry call does not actually make a connection to the remote host. It simply creates a local reference to the remote registry and will succeed even if no registry is running on the remote host. Therefore, a subsequent method invocation to a remote registry returned as a result of this method may fail.
    I hope I answered your question.

  • Cant store Listbox.selecteditem in Variable

    Hi Everybody,
    im build a littl Powershell Programm, and thought everything was going well, but now i hit a wall.
    Im Trying to store the selected item of 3 Listboxes in 3 variables but it wont work. if i Close the form and look into listbox11.selecteditem for example it Shows the value but while the form is open it wont store the value in the variable.
    I tryed so many sollutions but just cant seem to get it to work. maybe i dont see the error after looking at the script for so Long, i hope you can help me :-)
    $id=[System.Security.Principal.WindowsIdentity]::GetCurrent()
    $principal=new-object System.Security.Principal.WindowsPrincipal($id)
    if(!$principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {
    $powershell=[System.Diagnostics.Process]::GetCurrentProcess()
    $psi=new-object System.Diagnostics.ProcessStartInfo $powershell.path
    $Script=$MyInvocation.MyCommand.Path
    $prm=$script
    foreach($a in $args) {
    $prm+=' '+$a
    $psi.Arguments=$prm
    $psi.Verb="runas"
    [System.Diagnostics.Process]::Start($psi) | Out-Null
    return;
    $Network = Get-NetAdapter | where status -eq up | Select-Object -ExpandProperty Name
    Function GetIP {
    Get-NetIPAddress -InterfaceAlias $Network | where IPaddress -Like *.*.*.*|
    select-object -Property ipaddress,interfacealias
    $Interfaces = getip
    $IPS = $interfaces.ipaddress
    $Adapters = $interfaces.interfacealias
    Function GetHost {
    $GetHost = [System.Net.Dns]::GetHostEntry($IP).hostname
    $GetHost
    $DNSHost = GetHost
    Function GetLocalHost{
    $GetlocalHost = Get-Content env:computername
    $GetlocalHost
    $LOKHost = GetLocalHost
    Function Setip {
    $InterIndex = Get-NetIPAddress -InterfaceAlias $Network | select-object -exp InterfaceIndex | Select-Object -First 1
    Remove-NetIPAddress -IPAddress $IP
    new-NetIPAddress -Interfaceindex "$InterIndex" -IPAddress $EnterIP -PrefixLength 24
    Function GetDesc{
    $GetDesc = Get-WmiObject -Class Win32_OperatingSystem |Select Description
    $GetDesc | Select-Object -ExpandProperty Description
    $Desc = Getdesc
    Function SetDesc {
    $SetDesc = Set-ItemProperty -Path HKLM:\system\ControlSet001\Services\LanmanServer\Parameters -name srvcomment -value $NEWDesc
    Function Sethost{
    Rename-Computer $newlokHost
    $wscDefinition =@”
    // WSC_SECURITY_PROVIDER as defined in Wscapi.h or http://msdn.microsoft.com/en-us/library/bb432509(v=vs.85).aspx
    [Flags]
    public enum WSC_SECURITY_PROVIDER : int
    WSC_SECURITY_PROVIDER_FIREWALL = 1, // The aggregation of all firewalls for this computer.
    WSC_SECURITY_PROVIDER_AUTOUPDATE_SETTINGS = 2, // The automatic update settings for this computer.
    WSC_SECURITY_PROVIDER_ANTIVIRUS = 4, // The aggregation of all antivirus products for this computer.
    WSC_SECURITY_PROVIDER_ANTISPYWARE = 8, // The aggregation of all anti-spyware products for this computer.
    WSC_SECURITY_PROVIDER_INTERNET_SETTINGS = 16, // The settings that restrict the access of web sites in each of the Internet zones for this computer.
    WSC_SECURITY_PROVIDER_USER_ACCOUNT_CONTROL = 32, // The User Account Control (UAC) settings for this computer.
    WSC_SECURITY_PROVIDER_SERVICE = 64, // The running state of the WSC service on this computer.
    WSC_SECURITY_PROVIDER_NONE = 0, // None of the items that WSC monitors.
    // All of the items that the WSC monitors.
    WSC_SECURITY_PROVIDER_ALL = WSC_SECURITY_PROVIDER_FIREWALL | WSC_SECURITY_PROVIDER_AUTOUPDATE_SETTINGS | WSC_SECURITY_PROVIDER_ANTIVIRUS |
    WSC_SECURITY_PROVIDER_ANTISPYWARE | WSC_SECURITY_PROVIDER_INTERNET_SETTINGS | WSC_SECURITY_PROVIDER_USER_ACCOUNT_CONTROL |
    WSC_SECURITY_PROVIDER_SERVICE | WSC_SECURITY_PROVIDER_NONE
    [Flags]
    public enum WSC_SECURITY_PROVIDER_HEALTH : int
    WSC_SECURITY_PROVIDER_HEALTH_GOOD, // The status of the security provider category is good and does not need user attention.
    WSC_SECURITY_PROVIDER_HEALTH_NOTMONITORED, // The status of the security provider category is not monitored by WSC.
    WSC_SECURITY_PROVIDER_HEALTH_POOR, // The status of the security provider category is poor and the computer may be at risk.
    WSC_SECURITY_PROVIDER_HEALTH_SNOOZE, // The security provider category is in snooze state. Snooze indicates that WSC is not actively protecting the computer.
    WSC_SECURITY_PROVIDER_HEALTH_UNKNOWN
    // as defined in http://msdn.microsoft.com/en-us/library/bb432506(v=vs.85).aspx
    [DllImport("wscapi.dll")]
    private static extern int WscGetSecurityProviderHealth(int inValue, ref int outValue);
    // code to call our interop function and return the relevant result based on what input value we provide
    public static WSC_SECURITY_PROVIDER_HEALTH GetSecurityProviderHealth(WSC_SECURITY_PROVIDER inputValue)
    int inValue = (int)inputValue;
    int outValue = -1;
    int result = WscGetSecurityProviderHealth(inValue, ref outValue);
    foreach (WSC_SECURITY_PROVIDER_HEALTH wsph in Enum.GetValues(typeof(WSC_SECURITY_PROVIDER_HEALTH)))
    if ((int)wsph == outValue) return wsph;
    return WSC_SECURITY_PROVIDER_HEALTH.WSC_SECURITY_PROVIDER_HEALTH_UNKNOWN;
    $wscType=Add-Type -memberDefinition $wscDefinition -name “wscType” -UsingNamespace “System.Reflection”,“System.Diagnostics” -PassThru
    $Virstat = if ($wscType[0]::GetSecurityProviderHealth($wscType[1]::WSC_SECURITY_PROVIDER_ANTIVIRUS) -eq $wscType[2]::WSC_SECURITY_PROVIDER_HEALTH_GOOD)
    “Anti-virus running and up-to-date.”
    else
    "Antivirus disabled or not up-to-Date"
    #function GenerateForm {
    # Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.10.0
    # Generated On: 10.10.2014 14:43
    # Generated By: Markus.Soeller
    #region Import the Assemblies
    [System.Reflection.Assembly]::loadwithpartialname("System.Drawing") | Out-Null
    [System.Reflection.Assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
    #endregion
    #region Generated Form Objects
    $form1 = New-Object System.Windows.Forms.Form
    $button1 = New-Object System.Windows.Forms.Button
    $ListBox12 = New-Object System.Windows.Forms.ListBox
    $ListBox13 = New-Object System.Windows.Forms.ListBox
    $ListBox11 = New-Object System.Windows.Forms.ListBox
    $label8 = New-Object System.Windows.Forms.Label
    $label7 = New-Object System.Windows.Forms.Label
    $textBox3 = New-Object System.Windows.Forms.TextBox
    $textBox2 = New-Object System.Windows.Forms.TextBox
    $textBox1 = New-Object System.Windows.Forms.TextBox
    $listBox5 = New-Object System.Windows.Forms.ListBox
    $listBox4 = New-Object System.Windows.Forms.ListBox
    $listBox3 = New-Object System.Windows.Forms.ListBox
    $listBox2 = New-Object System.Windows.Forms.ListBox
    $button3 = New-Object System.Windows.Forms.Button
    $button2 = New-Object System.Windows.Forms.Button
    $statusBar1 = New-Object System.Windows.Forms.StatusBar
    $label6 = New-Object System.Windows.Forms.Label
    $label5 = New-Object System.Windows.Forms.Label
    $label4 = New-Object System.Windows.Forms.Label
    $label3 = New-Object System.Windows.Forms.Label
    $label2 = New-Object System.Windows.Forms.Label
    $label1 = New-Object System.Windows.Forms.Label
    $panel1 = New-Object System.Windows.Forms.Panel
    $button4 = New-Object System.Windows.Forms.Button
    $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
    #endregion Generated Form Objects
    #Generated Event Script Blocks
    #Provide Custom Code for events specified in PrimalForms.
    $button1_OnClick=
    $form1.Close()
    $handler_label3_Click=
    #TODO: Place custom script here
    $handler_textBox1_TextChanged=
    #TODO: Place custom script here
    $button4_OnClick=
    $SelectIp | out-host
    $selectInterface | out-host
    $selecttype | out-host
    $handler_label2_Click=
    #TODO: Place custom script here
    $handler_label6_Click=
    #TODO: Place custom script here
    $handler_label5_Click=
    #TODO: Place custom script here
    $handler_label4_Click=
    #TODO: Place custom script here
    $button2_OnClick=
    $NEWDesc = $textBox2.Text
    $Listbox2.items.RemoveAt(0)
    setdesc
    $desc=getdesc
    $Listbox2.items.add($Desc)
    $handler_label7_Click=
    #TODO: Place custom script here
    $handler_label1_Click=
    #TODO: Place custom script here
    $button3_OnClick=
    $NewlokHost = $textbox3.Text
    $Listbox3.items.RemoveAt(0)
    sethost
    $LOKHost = GetLocalHost
    $Listbox3.items.add($LOKHost)
    $OnLoadForm_StateCorrection=
    {#Correct the initial state of the form to prevent the .Net maximized form issue
    $form1.WindowState = $InitialFormWindowState
    #region Generated Form Code
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 512
    $System_Drawing_Size.Width = 1010
    $form1.ClientSize = $System_Drawing_Size
    $form1.DataBindings.DefaultDataSourceUpdateMode = 0
    $form1.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
    $form1.Name = "form1"
    $form1.Text = "After Deployment Check"
    $button1.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $button1.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 786
    $System_Drawing_Point.Y = 421
    $button1.Location = $System_Drawing_Point
    $button1.Name = "button1"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 49
    $System_Drawing_Size.Width = 169
    $button1.Size = $System_Drawing_Size
    $button1.TabIndex = 24
    $button1.Text = "Exit Deployment Check"
    $button1.UseVisualStyleBackColor = $False
    $button1.add_Click($button1_OnClick)
    $form1.Controls.Add($button1)
    $ListBox12.DataBindings.DefaultDataSourceUpdateMode = 0
    $ListBox12.FormattingEnabled = $True
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 162
    $System_Drawing_Point.Y = 295
    $ListBox12.Location = $System_Drawing_Point
    $ListBox12.Name = "ListBox12"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 49
    $System_Drawing_Size.Width = 133
    $ListBox12.Size = $System_Drawing_Size
    $ListBox12.TabIndex = 22
    $form1.Controls.Add($ListBox12)
    Foreach ($IP in $IPs) {
    $ListBox12.items.add($IP)
    $ListBox12.add_click({$SelectIP = $ListBox12.SelectedItem})
    $ListBox13.DataBindings.DefaultDataSourceUpdateMode = 0
    $ListBox13.FormattingEnabled = $True
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 300
    $System_Drawing_Point.Y = 295
    $ListBox13.Location = $System_Drawing_Point
    $ListBox13.Name = "ListBox13"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 49
    $System_Drawing_Size.Width = 133
    $ListBox13.Size = $System_Drawing_Size
    $ListBox13.TabIndex = 24
    $form1.Controls.Add($ListBox13)
    Foreach ($Adapter in $Adapters) {
    $Listbox13.items.add($Adapter)
    $listbox13.add_click({$selectinterface = $Listbox13.SelectedItem})
    $ListBox11.DataBindings.DefaultDataSourceUpdateMode = 0
    $ListBox11.FormattingEnabled = $True
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 160
    $System_Drawing_Point.Y = 357
    $ListBox11.Location = $System_Drawing_Point
    $ListBox11.Name = "ListBox1"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 49
    $System_Drawing_Size.Width = 278
    $ListBox11.Size = $System_Drawing_Size
    $ListBox11.TabIndex = 20
    $form1.Controls.Add($ListBox11)
    $InterfaceAliases="Internal","External"
    Foreach ($Interfacealias in $Interfacealiases) {
    $Listbox11.items.add($Interfacealias)
    $ListBox11.add_click({$selecttype = $listbox11.selecteditem})
    $label8.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label8.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 13
    $System_Drawing_Point.Y = 357
    $label8.Location = $System_Drawing_Point
    $label8.Name = "label8"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 49
    $System_Drawing_Size.Width = 142
    $label8.Size = $System_Drawing_Size
    $label8.TabIndex = 19
    $label8.Text = "Neuer Interface Name:"
    $form1.Controls.Add($label8)
    $label7.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label7.DataBindings.DefaultDataSourceUpdateMode = 0
    $label7.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 13
    $System_Drawing_Point.Y = 421
    $label7.Location = $System_Drawing_Point
    $label7.Name = "label7"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 27
    $System_Drawing_Size.Width = 142
    $label7.Size = $System_Drawing_Size
    $label7.TabIndex = 18
    $label7.Text = "Neue IP Adresse:"
    $label7.add_Click($handler_label7_Click)
    $form1.Controls.Add($label7)
    $textBox3.DataBindings.DefaultDataSourceUpdateMode = 0
    $textBox3.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12.75,0,3,0)
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 634
    $System_Drawing_Point.Y = 137
    $textBox3.Location = $System_Drawing_Point
    $textBox3.Name = "textBox3"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 27
    $System_Drawing_Size.Width = 321
    $textBox3.Size = $System_Drawing_Size
    $textBox3.TabIndex = 17
    $form1.Controls.Add($textBox3)
    $textBox2.DataBindings.DefaultDataSourceUpdateMode = 0
    $textBox2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12.75,0,3,0)
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 634
    $System_Drawing_Point.Y = 98
    $textBox2.Location = $System_Drawing_Point
    $textBox2.Name = "textBox2"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 27
    $System_Drawing_Size.Width = 321
    $textBox2.Size = $System_Drawing_Size
    $textBox2.TabIndex = 16
    $form1.Controls.Add($textBox2)
    $textBox1.DataBindings.DefaultDataSourceUpdateMode = 0
    $textBox1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12.75,0,3,0)
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 160
    $System_Drawing_Point.Y = 421
    $textBox1.Location = $System_Drawing_Point
    $textBox1.Name = "textBox1"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 27
    $System_Drawing_Size.Width = 278
    $textBox1.Size = $System_Drawing_Size
    $textBox1.TabIndex = 15
    $textBox1.add_TextChanged($handler_textBox1_TextChanged)
    $form1.Controls.Add($textBox1)
    $listBox5.DataBindings.DefaultDataSourceUpdateMode = 0
    $listBox5.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12.75,0,3,0)
    $listBox5.FormattingEnabled = $True
    $listBox5.ItemHeight = 20
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 160
    $System_Drawing_Point.Y = 216
    $listBox5.Location = $System_Drawing_Point
    $listBox5.Name = "listBox5"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 24
    $System_Drawing_Size.Width = 276
    $listBox5.Size = $System_Drawing_Size
    $listBox5.TabIndex = 14
    $form1.Controls.Add($listBox5)
    $Listbox5.items.add($VIRStat)
    $listBox4.DataBindings.DefaultDataSourceUpdateMode = 0
    $listBox4.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12.75,0,3,0)
    $listBox4.FormattingEnabled = $True
    $listBox4.ItemHeight = 20
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 160
    $System_Drawing_Point.Y = 178
    $listBox4.Location = $System_Drawing_Point
    $listBox4.Name = "listBox4"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 24
    $System_Drawing_Size.Width = 277
    $listBox4.Size = $System_Drawing_Size
    $listBox4.TabIndex = 13
    $form1.Controls.Add($listBox4)
    $Listbox4.items.add($DNSHost)
    $listBox3.DataBindings.DefaultDataSourceUpdateMode = 0
    $listBox3.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12.75,0,3,0)
    $listBox3.FormattingEnabled = $True
    $listBox3.ItemHeight = 20
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 160
    $System_Drawing_Point.Y = 137
    $listBox3.Location = $System_Drawing_Point
    $listBox3.Name = "listBox3"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 24
    $System_Drawing_Size.Width = 277
    $listBox3.Size = $System_Drawing_Size
    $listBox3.TabIndex = 12
    $form1.Controls.Add($listBox3)
    $Listbox3.items.add($LOKHost)
    $listBox2.DataBindings.DefaultDataSourceUpdateMode = 0
    $listBox2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12.75,0,3,0)
    $listBox2.FormattingEnabled = $True
    $listBox2.ItemHeight = 20
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 161
    $System_Drawing_Point.Y = 97
    $listBox2.Location = $System_Drawing_Point
    $listBox2.Name = "listBox2"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 24
    $System_Drawing_Size.Width = 278
    $listBox2.Size = $System_Drawing_Size
    $listBox2.TabIndex = 11
    $form1.Controls.Add($listBox2)
    $Listbox2.items.add($Desc)
    $button3.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 445
    $System_Drawing_Point.Y = 135
    $button3.Location = $System_Drawing_Point
    $button3.Name = "button3"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 32
    $System_Drawing_Size.Width = 183
    $button3.Size = $System_Drawing_Size
    $button3.TabIndex = 9
    $button3.Text = "Set Host Name"
    $button3.UseVisualStyleBackColor = $True
    $button3.add_Click($button3_OnClick)
    $form1.Controls.Add($button3)
    $button2.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 445
    $System_Drawing_Point.Y = 97
    $button2.Location = $System_Drawing_Point
    $button2.Name = "button2"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 30
    $System_Drawing_Size.Width = 183
    $button2.Size = $System_Drawing_Size
    $button2.TabIndex = 8
    $button2.Text = "Set Computer Description"
    $button2.UseVisualStyleBackColor = $True
    $button2.add_Click($button2_OnClick)
    $form1.Controls.Add($button2)
    $statusBar1.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 0
    $System_Drawing_Point.Y = 490
    $statusBar1.Location = $System_Drawing_Point
    $statusBar1.Name = "statusBar1"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 22
    $System_Drawing_Size.Width = 1010
    $statusBar1.Size = $System_Drawing_Size
    $statusBar1.TabIndex = 6
    $statusBar1.Text = "Deployment Check"
    $form1.Controls.Add($statusBar1)
    $label6.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label6.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 13
    $System_Drawing_Point.Y = 216
    $label6.Location = $System_Drawing_Point
    $label6.Name = "label6"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 30
    $System_Drawing_Size.Width = 142
    $label6.Size = $System_Drawing_Size
    $label6.TabIndex = 5
    $label6.Text = "Antiviren Status:"
    $label6.add_Click($handler_label6_Click)
    $form1.Controls.Add($label6)
    $label5.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label5.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 13
    $System_Drawing_Point.Y = 178
    $label5.Location = $System_Drawing_Point
    $label5.Name = "label5"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 30
    $System_Drawing_Size.Width = 142
    $label5.Size = $System_Drawing_Size
    $label5.TabIndex = 4
    $label5.Text = "Hostname [DNS]:"
    $label5.add_Click($handler_label5_Click)
    $form1.Controls.Add($label5)
    $label4.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label4.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 13
    $System_Drawing_Point.Y = 137
    $label4.Location = $System_Drawing_Point
    $label4.Name = "label4"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 32
    $System_Drawing_Size.Width = 142
    $label4.Size = $System_Drawing_Size
    $label4.TabIndex = 3
    $label4.Text = "Hostname [Lokal]:"
    $label4.add_Click($handler_label4_Click)
    $form1.Controls.Add($label4)
    $label3.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label3.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 13
    $System_Drawing_Point.Y = 97
    $label3.Location = $System_Drawing_Point
    $label3.Name = "label3"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 30
    $System_Drawing_Size.Width = 142
    $label3.Size = $System_Drawing_Size
    $label3.TabIndex = 2
    $label3.Text = "Computer Description:"
    $label3.add_Click($handler_label3_Click)
    $form1.Controls.Add($label3)
    $label2.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label2.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 13
    $System_Drawing_Point.Y = 295
    $label2.Location = $System_Drawing_Point
    $label2.Name = "label2"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 49
    $System_Drawing_Size.Width = 142
    $label2.Size = $System_Drawing_Size
    $label2.TabIndex = 1
    $label2.Text = "IP Adresse:"
    $label2.add_Click($handler_label2_Click)
    $form1.Controls.Add($label2)
    $label1.BackColor = [System.Drawing.Color]::FromArgb(255,153,180,209)
    $label1.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 12
    $System_Drawing_Point.Y = 9
    $label1.Location = $System_Drawing_Point
    $label1.Name = "label1"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 20
    $System_Drawing_Size.Width = 143
    $label1.Size = $System_Drawing_Size
    $label1.TabIndex = 0
    $label1.Text = "Deployment Check"
    $label1.add_Click($handler_label1_Click)
    $form1.Controls.Add($label1)
    $panel1.BackColor = [System.Drawing.Color]::FromArgb(255,0,102,204)
    $panel1.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 12
    $System_Drawing_Point.Y = 261
    $panel1.Location = $System_Drawing_Point
    $panel1.Name = "panel1"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 209
    $System_Drawing_Size.Width = 754
    $panel1.Size = $System_Drawing_Size
    $panel1.TabIndex = 23
    $form1.Controls.Add($panel1)
    $button4.DataBindings.DefaultDataSourceUpdateMode = 0
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 433
    $System_Drawing_Point.Y = 34
    $button4.Location = $System_Drawing_Point
    $button4.Name = "button4"
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Height = 49
    $System_Drawing_Size.Width = 183
    $button4.Size = $System_Drawing_Size
    $button4.TabIndex = 21
    $button4.Text = "Set Network Adapter"
    $button4.UseVisualStyleBackColor = $True
    $button4.add_Click($button4_OnClick)
    $panel1.Controls.Add($button4)
    #endregion Generated Form Code
    #Save the initial state of the form
    $InitialFormWindowState = $form1.WindowState
    #Init the OnLoad event to correct the initial state of the form
    $form1.add_Load($OnLoadForm_StateCorrection)
    #Show the Form
    $form1.ShowDialog()| Out-Null
    #} #End Function
    #Call the Function
    #GenerateForm
    best regards markus

    CE is a bit of an abandoned product but it will generate forms.
    TO return a form just create a global in the onload call.
    $global:ThisForm=$form1
    Now the form is available after it has closed.  Do not remove the function wrapper.
    Avoid wrapping everythingin functions as it make the code unmaintainable and leads to subtle, difficult to find, errors.
    Example - this is all of the code needed to replace 30 + lines of poorly written code:
    $adapters=Get-NetAdapter |?{$_.Status -eq 'Up'}|Get-NetIPAddress -AddressFamily IPv4
    $IPAddress=$adapters.IPAddresss
    $Adapters=$IPAddress.InterfaceAlias
    $DNSHost = [System.Net.Dns]::GetHostEntry($IP).hostname
    $LOKHost = Get-Content env:computername
    All of this should be in the "onload" and the results should be directly assigned to form objects.  Avoid interceding variables.
    ¯\_(ツ)_/¯
    thanks i will go trough my script and clean it up, at the beginning i thought building functions was a good idea but i quickly realised that its not really helpful in this scenario so i will stop doing so in the future for similar projects. :-)

  • Sort and filer a binded collection in a ListBox

    Hello,
    in my application, I have a listbox which is binded to a collection of objects. Collection element is of Student type and each student is having a 'Name' property which is displayed in the ListBox item.
    Now I want to add a filter and sort functionality in the UI.. How I can do this using only xaml code and no backend .cs file code.
    I want to add one button for sorting items in the UI this button should toggle the view from normal to sorted in the UI. Also the filter button display the elements in the UI
    thanks,
    IamHuM

    "How I can do this using only xaml code and no backend .cs file code."
    I think you will need some code.
    If you look at this:
    <CollectionViewSource Source="{StaticResource places}" x:Key="cvs">
    <CollectionViewSource.SortDescriptions>
    <scm:SortDescription PropertyName="CityName"/>
    </CollectionViewSource.SortDescriptions>
    <CollectionViewSource.GroupDescriptions>
    <dat:PropertyGroupDescription PropertyName="State"/>
    </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>
    You  would need a trigger to change a sortdescription. I can't think of a way to do that.
    Similarly the filter of a collectionviewsource.
    You need some predicate from somewhere. 
    If you were happy with using code then that'd be fine.
    http://social.technet.microsoft.com/wiki/contents/articles/26673.wpf-collectionview-tips.aspx
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

Maybe you are looking for

  • Excel addin and Web Analysis Security

    Hi All Can anybody tell me how to use user security in webanalysis. I have created few report using admin user. Now i can see those reports when i login with a user that doesnt have access to the cost center that this reports having . Can anybody hel

  • After upgrade from 4.6c to ECC6.0 F4 Help is not coming for few date fields

    Hi Friends Just now we have completed upgrade project from 4.6c to ECC6.0. After upgrade F4 help is not working for some date fields. For example its working in MB11,Its not working in va01,vf01 like that. In abap side we checked ...not able to find

  • Itunes 10.5.2. hanging up during IPhone 4 Sync

    I have an Imac running OS 10.6.8 and am using Itunes 10.5.2. on same.  Ever since the recent unfortunate debut of Icloud and wifi syncing, I have been having nothing but tons of problems with Apple sync software creating thousands of duplicate entrie

  • Vector MSO not vector in iOS7

    Here are the specs: Adobe InDesign CC Latest release of Content Viewer V28 DPS tools, updated APP builder v28 PDF folio v27 iPad 4 iOS7 Multi State Objects in Indesign files are set up correctly to upscale as vector text. In the Content Viewer this w

  • Strange query / explain plan

    (I posted this in the Oracle Text forum, but I think it's as appropriate here.) Consider the following queries: :the_filter := 'FILE'; (1) SELECT COUNT(*) FROM FOO WHERE CONTAINS(search_col,:the_filter) > 0; (2) SELECT COUNT(*) FROM FOO WHERE 'FILE'