Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. ArrayControl [modified]

ArrayControl [modified]

Scheduled Pinned Locked Moved C#
csharpdatabasedata-structureshelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mghiassi
    wrote on last edited by
    #1

    Please help me. I use Visual c# 2005. I want to use some control with same name and diffrent index like control array. Please tell me i can use what property of controls like DropDownList Thanks in advance. -- modified at 14:57 Monday 13th August, 2007

    C L 2 Replies Last reply
    0
    • M mghiassi

      Please help me. I use Visual c# 2005. I want to use some control with same name and diffrent index like control array. Please tell me i can use what property of controls like DropDownList Thanks in advance. -- modified at 14:57 Monday 13th August, 2007

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can create an array of controls if you'd like. What are you trying to do exactly ? Or do you mean the Items property on the data bound controls ?

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • M mghiassi

        Please help me. I use Visual c# 2005. I want to use some control with same name and diffrent index like control array. Please tell me i can use what property of controls like DropDownList Thanks in advance. -- modified at 14:57 Monday 13th August, 2007

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Hi, Visual Designer will not let you do this; it insists on having unique names for controls. There are two ways to solve this: - don't use VD for these controls, just create your controls programmatically, so you can give them any valid name you choose, including array[index]-like names provided you declare such an array of course. - keep the controls as they are; now create a collection (array, ArrayList, List, whatever) and add the controls to that list. BTW: maybe you don't need anything new; you can iterate over all controls in a container like this:

        foreach(Control c in this.Controls) {
        Button btn=c as Button;
        if (btn!=null) btn.PerformClick();
        }

        The above would find all buttons and click them one by one. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


        G 1 Reply Last reply
        0
        • L Luc Pattyn

          Hi, Visual Designer will not let you do this; it insists on having unique names for controls. There are two ways to solve this: - don't use VD for these controls, just create your controls programmatically, so you can give them any valid name you choose, including array[index]-like names provided you declare such an array of course. - keep the controls as they are; now create a collection (array, ArrayList, List, whatever) and add the controls to that list. BTW: maybe you don't need anything new; you can iterate over all controls in a container like this:

          foreach(Control c in this.Controls) {
          Button btn=c as Button;
          if (btn!=null) btn.PerformClick();
          }

          The above would find all buttons and click them one by one. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          And you can also examine tag property of the control to identify exactly which one it is.

          #region signature my articles #endregion

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups