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. Adding Columns in DataGrid at run time

Adding Columns in DataGrid at run time

Scheduled Pinned Locked Moved C#
help
31 Posts 21 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.
  • A Offline
    A Offline
    aloktambi
    wrote on last edited by
    #1

    Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

    J M P T P 11 Replies Last reply
    0
    • A aloktambi

      Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

      J Offline
      J Offline
      Justin Perez
      wrote on last edited by
      #2

      Do you mean 25,000 ROWS? I can't think of any reason a table would need 25,000 columns.

      I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

      A W 2 Replies Last reply
      0
      • J Justin Perez

        Do you mean 25,000 ROWS? I can't think of any reason a table would need 25,000 columns.

        I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

        A Offline
        A Offline
        aloktambi
        wrote on last edited by
        #3

        No sir, i mean 25000 columns . it is req. of our software

        J 1 Reply Last reply
        0
        • A aloktambi

          No sir, i mean 25000 columns . it is req. of our software

          J Offline
          J Offline
          Justin Perez
          wrote on last edited by
          #4

          aloktambi wrote:

          No sir, i mean 25000 columns . it is req. of our software

          Wow. That sounds very messy. If you don't mind explaining, why is this a requirement? What circumstances force this, and what is the usage of the table?

          I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

          A 1 Reply Last reply
          0
          • J Justin Perez

            aloktambi wrote:

            No sir, i mean 25000 columns . it is req. of our software

            Wow. That sounds very messy. If you don't mind explaining, why is this a requirement? What circumstances force this, and what is the usage of the table?

            I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

            A Offline
            A Offline
            aloktambi
            wrote on last edited by
            #5

            Sir, In our software, we want to show peak information to user, No of Columns for General Info = 7 (Constant) No of Columns for Injection Info = 22 (Constant) No of Fixed Column(s) for Peak Info = 1(Constant) //It is for Peak Area Sum. Total No of Columns for N Peaks: N x (13 + 2 x N) Hence total Number of Columns in Datagrid in case of N Peaks = 1(Separator) + 7 + 1(Separator) + 22 + 1(Separator) + 1 + N(13+2N) = 2xNxN + 13xN + 33 Hence Number of Columns in the Datagrid increase as a 2nd Degree Equation. This means For 10 peaks Column Count will be 363 For 25 peaks Column Count will be 1608 For 50 peaks Column Count will be 5683 For 100 peaks Column Count will be 21333 For 150 peaks Column Count will be 46983 For 200 peaks Column Count will be 82633

            J D M J 4 Replies Last reply
            0
            • A aloktambi

              Sir, In our software, we want to show peak information to user, No of Columns for General Info = 7 (Constant) No of Columns for Injection Info = 22 (Constant) No of Fixed Column(s) for Peak Info = 1(Constant) //It is for Peak Area Sum. Total No of Columns for N Peaks: N x (13 + 2 x N) Hence total Number of Columns in Datagrid in case of N Peaks = 1(Separator) + 7 + 1(Separator) + 22 + 1(Separator) + 1 + N(13+2N) = 2xNxN + 13xN + 33 Hence Number of Columns in the Datagrid increase as a 2nd Degree Equation. This means For 10 peaks Column Count will be 363 For 25 peaks Column Count will be 1608 For 50 peaks Column Count will be 5683 For 100 peaks Column Count will be 21333 For 150 peaks Column Count will be 46983 For 200 peaks Column Count will be 82633

              J Offline
              J Offline
              Justin Perez
              wrote on last edited by
              #6

              Well that is interesting. I can't think of any way to create 25,000 columns in a fast way(like can be done with SQLBulkCopy for rows). Good luck though!

              I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

              1 Reply Last reply
              0
              • A aloktambi

                Sir, In our software, we want to show peak information to user, No of Columns for General Info = 7 (Constant) No of Columns for Injection Info = 22 (Constant) No of Fixed Column(s) for Peak Info = 1(Constant) //It is for Peak Area Sum. Total No of Columns for N Peaks: N x (13 + 2 x N) Hence total Number of Columns in Datagrid in case of N Peaks = 1(Separator) + 7 + 1(Separator) + 22 + 1(Separator) + 1 + N(13+2N) = 2xNxN + 13xN + 33 Hence Number of Columns in the Datagrid increase as a 2nd Degree Equation. This means For 10 peaks Column Count will be 363 For 25 peaks Column Count will be 1608 For 50 peaks Column Count will be 5683 For 100 peaks Column Count will be 21333 For 150 peaks Column Count will be 46983 For 200 peaks Column Count will be 82633

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                There's no way to create that many columns that fast. You're ARE going to have to find a different way to present your data. Just scrolling that many columns is going to be painfully slow. On a 19" monitor, with all of these columns widths set at, say, a half inch wide, you're DataGrid would be almost A QUARTER OF A MILE (0.4km) WIDE!! A bit excessive, wouldn't you say? This sounds more like a job for some kind of graph, not a DataGrid.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007

                D T 2 Replies Last reply
                0
                • D Dave Kreskowiak

                  There's no way to create that many columns that fast. You're ARE going to have to find a different way to present your data. Just scrolling that many columns is going to be painfully slow. On a 19" monitor, with all of these columns widths set at, say, a half inch wide, you're DataGrid would be almost A QUARTER OF A MILE (0.4km) WIDE!! A bit excessive, wouldn't you say? This sounds more like a job for some kind of graph, not a DataGrid.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007

                  D Offline
                  D Offline
                  Dan Neely
                  wrote on last edited by
                  #8

                  Dave Kreskowiak wrote:

                  This sounds more like a job for some kind of graph, not a DataGrid.

                  Depends what the data needs to be visualized for. A graph would be the way to go if the general distribution is needed. If the user needs to be able to check the value of a parameter some sort of browsing tool would be a better alternative.

                  -- If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.

                  D 1 Reply Last reply
                  0
                  • D Dan Neely

                    Dave Kreskowiak wrote:

                    This sounds more like a job for some kind of graph, not a DataGrid.

                    Depends what the data needs to be visualized for. A graph would be the way to go if the general distribution is needed. If the user needs to be able to check the value of a parameter some sort of browsing tool would be a better alternative.

                    -- If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    I was thinking some kind of a grid were you could zoom in and see more detail, and possibly get a table showing the values if you zoomed in far enough, or maybe even hover the mouse over a point on the graph and have a floating table show you the values.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007

                    1 Reply Last reply
                    0
                    • A aloktambi

                      Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                      M Offline
                      M Offline
                      Maximilien
                      wrote on last edited by
                      #10

                      :omg: I think you really need to review your design. It's not possible for a human to view that much information all at once, even less to do some sort of analysis on it. We will need to find better ways to present the results to the users.


                      Maximilien Lincourt Your Head A Splode - Strong Bad

                      1 Reply Last reply
                      0
                      • A aloktambi

                        Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                        P Offline
                        P Offline
                        Phil J Pearson
                        wrote on last edited by
                        #11

                        Why don't you try using 25,000 DataGrids with one column each?

                        Phil


                        The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.

                        1 Reply Last reply
                        0
                        • A aloktambi

                          Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                          T Offline
                          T Offline
                          thrakazog
                          wrote on last edited by
                          #12

                          Please let us know when your project is complete so we can post it on http://worsethanfailure.com/

                          1 Reply Last reply
                          0
                          • A aloktambi

                            Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                            P Offline
                            P Offline
                            Paul Conrad
                            wrote on last edited by
                            #13

                            aloktambi wrote:

                            25000 columns

                            :wtf::omg: Don't think that is really possible.

                            "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                            1 Reply Last reply
                            0
                            • A aloktambi

                              Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #14

                              Pfft DataGrids cause a localized lowering of the ambient air pressure; I avoid them at all cost. :cool:

                              1 Reply Last reply
                              0
                              • A aloktambi

                                Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                                N Offline
                                N Offline
                                NormDroid
                                wrote on last edited by
                                #15

                                You need to design a custom control, which meets the criteria of you're data you are trying to present. A grid with 25000 columns isn't the way to go, you need a customized grid and when the user scrolls left/right load the columns on demand, it's easy with .net and even easier with WPF. A good software design engineer (cough, cough) such as my self would be able to create such a control (obviously your company would be billed).

                                WPF - Imagineers Wanted Follow your nose using DoubleAnimationUsingPath

                                1 Reply Last reply
                                0
                                • A aloktambi

                                  Sir, In our software, we want to show peak information to user, No of Columns for General Info = 7 (Constant) No of Columns for Injection Info = 22 (Constant) No of Fixed Column(s) for Peak Info = 1(Constant) //It is for Peak Area Sum. Total No of Columns for N Peaks: N x (13 + 2 x N) Hence total Number of Columns in Datagrid in case of N Peaks = 1(Separator) + 7 + 1(Separator) + 22 + 1(Separator) + 1 + N(13+2N) = 2xNxN + 13xN + 33 Hence Number of Columns in the Datagrid increase as a 2nd Degree Equation. This means For 10 peaks Column Count will be 363 For 25 peaks Column Count will be 1608 For 50 peaks Column Count will be 5683 For 100 peaks Column Count will be 21333 For 150 peaks Column Count will be 46983 For 200 peaks Column Count will be 82633

                                  M Offline
                                  M Offline
                                  Manuel F Hernandez
                                  wrote on last edited by
                                  #16

                                  What the heck is this anyway. The fact that you are trying to view this data it is such an un-normalized fashion completely fascinates me. Shouldn't you be grouping these things? General info should be a table Injection data should be a table the peaks thing sounds like a function or a set of functions You should create this databse using meaningful relations. If you need to view dynamics mabye you should apply some differential analysis or maybe use graphs with animation. Good luck

                                  1 Reply Last reply
                                  0
                                  • A aloktambi

                                    Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                                    L Offline
                                    L Offline
                                    leppie
                                    wrote on last edited by
                                    #17

                                    The only thing that can possibly handle that amount of columns is Excel 2007 where the column limit has been increased. I think this is your best bet too, in terms of rendering to screen compared to DataGrid. -- modified at 18:41 Saturday 13th October, 2007

                                    xacc.ide
                                    The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."

                                    1 Reply Last reply
                                    0
                                    • A aloktambi

                                      Dear Sir, I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid

                                      X Offline
                                      X Offline
                                      Xiangyang Liu
                                      wrote on last edited by
                                      #18

                                      May I suggest the following? 1. Have a small fixed number of columns on your screen, say 10. 2. Add two honrizontal arrows on the screen that when clicked would show users the next/previous 10 columns.

                                      My .NET Business Application Framework My Home Page

                                      D 1 Reply Last reply
                                      0
                                      • A aloktambi

                                        Sir, In our software, we want to show peak information to user, No of Columns for General Info = 7 (Constant) No of Columns for Injection Info = 22 (Constant) No of Fixed Column(s) for Peak Info = 1(Constant) //It is for Peak Area Sum. Total No of Columns for N Peaks: N x (13 + 2 x N) Hence total Number of Columns in Datagrid in case of N Peaks = 1(Separator) + 7 + 1(Separator) + 22 + 1(Separator) + 1 + N(13+2N) = 2xNxN + 13xN + 33 Hence Number of Columns in the Datagrid increase as a 2nd Degree Equation. This means For 10 peaks Column Count will be 363 For 25 peaks Column Count will be 1608 For 50 peaks Column Count will be 5683 For 100 peaks Column Count will be 21333 For 150 peaks Column Count will be 46983 For 200 peaks Column Count will be 82633

                                        J Offline
                                        J Offline
                                        jhwurmbach
                                        wrote on last edited by
                                        #19

                                        Mass Spec? Anyway - you would need something like a tree to group the data. You would then only have a constant set of Entries and N Pak-Entries with the Peakinfo underneath.


                                        Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
                                        George Orwell, "Keep the Aspidistra Flying", Opening words

                                        1 Reply Last reply
                                        0
                                        • X Xiangyang Liu

                                          May I suggest the following? 1. Have a small fixed number of columns on your screen, say 10. 2. Add two honrizontal arrows on the screen that when clicked would show users the next/previous 10 columns.

                                          My .NET Business Application Framework My Home Page

                                          D Offline
                                          D Offline
                                          Dave Kreskowiak
                                          wrote on last edited by
                                          #20

                                          And to get to the middle of the grid, you want the user to click the right arrow button, what, 1,250 times??

                                          A guide to posting questions on CodeProject[^]
                                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                               2006, 2007

                                          X 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