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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. 2 dimension textbox array

2 dimension textbox array

Scheduled Pinned Locked Moved C#
data-structurestutorialquestion
3 Posts 2 Posters 1 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.
  • H Offline
    H Offline
    hkl
    wrote on last edited by
    #1

    Hello, May I know how I can create a 2 dimension textbox array? I know how to create a 1 dimension textbox array, but I am having trouble trying the 2D. Thank you!!

    H 1 Reply Last reply
    0
    • H hkl

      Hello, May I know how I can create a 2 dimension textbox array? I know how to create a 1 dimension textbox array, but I am having trouble trying the 2D. Thank you!!

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      It depends what kind of multi-dimensional array. There are multi-dimensional arrays and jagged arrays. The former is declared like this:

      TextBox[,] boxes = new TextBox[,] {{textBox1, textBox1},
      {textBox1, textBox2}, {textBox2, textBox2}};

      These types of arrays have fixed dimensions and sizes. Jaggaed arrays' elements are arrays themselves, like this:

      TextBox[][] boxes = new TextBox[] {
      new TextBox[] {textBox1, textBox1},
      new TextBox[] {textBox1, textBox2},
      new TextBox[] {textBox2, textBox2},
      new TextBox[] {textBox1},
      new TextBox[] {textBox2}};

      As you can see, these can have different dimensions and sizes. You can find more information by reading about Arrays[^] in the Visual C# language documentation.

      Microsoft MVP, Visual C# My Articles

      H 1 Reply Last reply
      0
      • H Heath Stewart

        It depends what kind of multi-dimensional array. There are multi-dimensional arrays and jagged arrays. The former is declared like this:

        TextBox[,] boxes = new TextBox[,] {{textBox1, textBox1},
        {textBox1, textBox2}, {textBox2, textBox2}};

        These types of arrays have fixed dimensions and sizes. Jaggaed arrays' elements are arrays themselves, like this:

        TextBox[][] boxes = new TextBox[] {
        new TextBox[] {textBox1, textBox1},
        new TextBox[] {textBox1, textBox2},
        new TextBox[] {textBox2, textBox2},
        new TextBox[] {textBox1},
        new TextBox[] {textBox2}};

        As you can see, these can have different dimensions and sizes. You can find more information by reading about Arrays[^] in the Visual C# language documentation.

        Microsoft MVP, Visual C# My Articles

        H Offline
        H Offline
        hkl
        wrote on last edited by
        #3

        Thank you:-D

        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