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. Error while displaying 2 dimentional data in data grid

Error while displaying 2 dimentional data in data grid

Scheduled Pinned Locked Moved C#
csshelp
6 Posts 3 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.
  • S Offline
    S Offline
    saksp
    wrote on last edited by
    #1

    I am getting error when I do following. string[,] myArray = new string[2,2]; myArray[0,0] = "elad"; myArray[0,1] = "3"; myArray[1,0] = "david"; myArray[1,1] = "5"; grd.DataSource = myArray; grd.DataBind();

    thanks

    V 1 Reply Last reply
    0
    • S saksp

      I am getting error when I do following. string[,] myArray = new string[2,2]; myArray[0,0] = "elad"; myArray[0,1] = "3"; myArray[1,0] = "david"; myArray[1,1] = "5"; grd.DataSource = myArray; grd.DataBind();

      thanks

      V Offline
      V Offline
      Vikram A Punathambekar
      wrote on last edited by
      #2

      What error? Compile error? Did your app crash? Did it screw your hard disk? Kick your dog? Steal your girlfriend? How are people supposed to help you if you don't tell them what's wrong in the first place?

      Cheers, Vıkram.

      Carpe Diem.

      S 1 Reply Last reply
      0
      • V Vikram A Punathambekar

        What error? Compile error? Did your app crash? Did it screw your hard disk? Kick your dog? Steal your girlfriend? How are people supposed to help you if you don't tell them what's wrong in the first place?

        Cheers, Vıkram.

        Carpe Diem.

        S Offline
        S Offline
        saksp
        wrote on last edited by
        #3

        Error was : "Array was not a one dimentional array"

        thanks

        M V 2 Replies Last reply
        0
        • S saksp

          Error was : "Array was not a one dimentional array"

          thanks

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #4

          saksp wrote:

          Error was : "Array was not a one dimentional array"

          OMG! How can people not understand a problem when the error message is so clear!

          Life goes very fast. Tomorrow, today is already yesterday.

          1 Reply Last reply
          0
          • S saksp

            Error was : "Array was not a one dimentional array"

            thanks

            V Offline
            V Offline
            Vikram A Punathambekar
            wrote on last edited by
            #5

            There you have it!!! Your array is jagged (multidimensional), but the grid expects a single dimensional array. Create a struct or a class with public properties for the grid's columns. Create an array of this type to represent the rows, and use that array as the data source.

            Cheers, Vıkram.

            Carpe Diem.

            S 1 Reply Last reply
            0
            • V Vikram A Punathambekar

              There you have it!!! Your array is jagged (multidimensional), but the grid expects a single dimensional array. Create a struct or a class with public properties for the grid's columns. Create an array of this type to represent the rows, and use that array as the data source.

              Cheers, Vıkram.

              Carpe Diem.

              S Offline
              S Offline
              saksp
              wrote on last edited by
              #6

              thanks i got it.

              thanks

              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