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. Hide Data Grid View Columns 2

Hide Data Grid View Columns 2

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

    Hello, Any help would be great! I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data in the data grid view. Even if i set the row height, it seems to make no difference. I need to set which columns are shown in code, and I change the data source for the data grid view as needed. I have also tryed (datagrid.columns[i].width = 0) and (col.width = 0), both produce the same result, the column width is changed to 0, but you can still see the column, only it appears as a line, and if you are hiding a few columns then it is very noticable. Also you can streach the columns with a width of 0 back out again. any help would be great. Thanks to thoes who replyed to my first question for this, I did try all suggestions. thanks, J

    N M 2 Replies Last reply
    0
    • J jasper018

      Hello, Any help would be great! I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data in the data grid view. Even if i set the row height, it seems to make no difference. I need to set which columns are shown in code, and I change the data source for the data grid view as needed. I have also tryed (datagrid.columns[i].width = 0) and (col.width = 0), both produce the same result, the column width is changed to 0, but you can still see the column, only it appears as a line, and if you are hiding a few columns then it is very noticable. Also you can streach the columns with a width of 0 back out again. any help would be great. Thanks to thoes who replyed to my first question for this, I did try all suggestions. thanks, J

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      jasper018 wrote:

      I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data

      Where have you tried this and what do you mean it shrinks the rows?

      jasper018 wrote:

      Thanks to thoes who replyed to my first question for this, I did try all suggestions.

      So this is a repost of the same question?


      only two letters away from being an asset

      J 1 Reply Last reply
      0
      • N Not Active

        jasper018 wrote:

        I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data

        Where have you tried this and what do you mean it shrinks the rows?

        jasper018 wrote:

        Thanks to thoes who replyed to my first question for this, I did try all suggestions.

        So this is a repost of the same question?


        only two letters away from being an asset

        J Offline
        J Offline
        jasper018
        wrote on last edited by
        #3

        answer question 1: when using the (datagrid.columns[i].visible = false) method when the data grid load in the form, the row height is set to 0, even if i reset is before it is displayed it does not change. so there for all the rows appear shrinked. I do not know why this is happening, and no matter what I do, or set, it seems to set the row height to 0. answer question 2: Yes I have posted this question before... the responses I had gotten, though helpfull, did not help with my problem, i am really stumped with this one.

        1 Reply Last reply
        0
        • J jasper018

          Hello, Any help would be great! I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data in the data grid view. Even if i set the row height, it seems to make no difference. I need to set which columns are shown in code, and I change the data source for the data grid view as needed. I have also tryed (datagrid.columns[i].width = 0) and (col.width = 0), both produce the same result, the column width is changed to 0, but you can still see the column, only it appears as a line, and if you are hiding a few columns then it is very noticable. Also you can streach the columns with a width of 0 back out again. any help would be great. Thanks to thoes who replyed to my first question for this, I did try all suggestions. thanks, J

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

          try to use AutoSizeMode=Fill for any visibale columan,, hope it will work

          J 2 Replies Last reply
          0
          • M MuhammadFaisal

            try to use AutoSizeMode=Fill for any visibale columan,, hope it will work

            J Offline
            J Offline
            jasper018
            wrote on last edited by
            #5

            Thanks i am going to give that a try!

            1 Reply Last reply
            0
            • M MuhammadFaisal

              try to use AutoSizeMode=Fill for any visibale columan,, hope it will work

              J Offline
              J Offline
              jasper018
              wrote on last edited by
              #6

              Thanks for the reply! :o) That did not seem to work either

              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