Wireless Communication Library Support Forum

Legacy => Wireless Communication Library => Topic started by: pshaw on June 22, 2010, 09:06:33 AM

Title: How to set wclClient control variable?
Post by: pshaw on June 22, 2010, 09:06:33 AM
Does anyone know how to programical set the wclClient control from a variable?  I have 8 wclClient controls on my form and based on a dropdown I want to connect to 1 of them.  For example, combo selected is 2, I want to connect to wclClient2.  This is what I tried but it doesn't find the control on my windows form:
            string strwclClientControlName = String.Format("wclClient{0}", tsbMonitoredRouter.SelectedItem);

            foreach (Control ctl in Controls)
            {
                if (ctl.Name == strwclClientControlName)
                {
                }
             }
Title: Re: How to set wclClient control variable?
Post by: Mike Petrichenko on June 22, 2010, 10:37:02 AM
Hi,

Use array of classes, not controls.
Title: Re: How to set wclClient control variable?
Post by: pshaw on June 22, 2010, 10:54:52 AM
Thanks for the quick reply.  I know this isn't a C# forum, but I am not sure how to do this with your control.  Can you provide a code sample of what I should change my code to?  Thanks.
Title: Re: How to set wclClient control variable?
Post by: Mike Petrichenko on June 22, 2010, 10:57:48 AM
Please, find the attached demo. It uses wclServer but it does not mater, just find the idea.

[attachment deleted by admin]
Title: Re: How to set wclClient control variable?
Post by: pshaw on June 22, 2010, 11:03:36 AM
That's perfect!  Thank you.