Author Topic: How to set wclClient control variable?  (Read 2026 times)

Offline pshaw

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
How to set wclClient control variable?
« 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)
                {
                }
             }

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: How to set wclClient control variable?
« Reply #1 on: June 22, 2010, 10:37:02 AM »
Hi,

Use array of classes, not controls.

Offline pshaw

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: How to set wclClient control variable?
« Reply #2 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.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: How to set wclClient control variable?
« Reply #3 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.

Offline pshaw

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: How to set wclClient control variable?
« Reply #4 on: June 22, 2010, 11:03:36 AM »
That's perfect!  Thank you.

 

Sitemap 1 2 3 4 5 6 7 8 9