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. DataGridView customization

DataGridView customization

Scheduled Pinned Locked Moved C#
questionphpalgorithmshelptutorial
8 Posts 2 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.
  • T Offline
    T Offline
    Tony Pottier
    wrote on last edited by
    #1

    Hello fellow coders. I'm having a hard time figuring out very easy thing with the datagridview so here is a screen of it in my program: datagrid My 2 questions are, I think, easy, but I can't find any solution and Google isnt helping me at all: - How to get ride of the left column (the one with the cursor that shows the selected rows), or at least, how to resize it to make it a fixed size ? - How to make column headers clickable? Currently in my program, the columns are not clickable and this is quite a huge issue for sorting things out. That followed with a 2nd question: how to programatically display a sorting glyph to the column header? Thank you!

    X 1 Reply Last reply
    0
    • T Tony Pottier

      Hello fellow coders. I'm having a hard time figuring out very easy thing with the datagridview so here is a screen of it in my program: datagrid My 2 questions are, I think, easy, but I can't find any solution and Google isnt helping me at all: - How to get ride of the left column (the one with the cursor that shows the selected rows), or at least, how to resize it to make it a fixed size ? - How to make column headers clickable? Currently in my program, the columns are not clickable and this is quite a huge issue for sorting things out. That followed with a 2nd question: how to programatically display a sorting glyph to the column header? Thank you!

      X Offline
      X Offline
      Xmen Real
      wrote on last edited by
      #2

      Tony_P wrote:

      - How to get ride of the left column (the one with the cursor that shows the selected rows), or at least, how to resize it to make it a fixed size ?

      set RowHeadersVisible property to false, and to resize it, DGV have a property named RowHeadersWidth

      Tony_P wrote:

      How to make column headers clickable? Currently in my program, the columns are not clickable

      what you wanna say ?? default is clickable

      TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

      T 1 Reply Last reply
      0
      • X Xmen Real

        Tony_P wrote:

        - How to get ride of the left column (the one with the cursor that shows the selected rows), or at least, how to resize it to make it a fixed size ?

        set RowHeadersVisible property to false, and to resize it, DGV have a property named RowHeadersWidth

        Tony_P wrote:

        How to make column headers clickable? Currently in my program, the columns are not clickable

        what you wanna say ?? default is clickable

        TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

        T Offline
        T Offline
        Tony Pottier
        wrote on last edited by
        #3

        set RowHeadersVisible property to false, and to resize it, DGV have a property named RowHeadersWidth Thank you! what you wanna say ?? default is clickable Well I'm feeding my datagridview with a SqlCeResultSet (through a BindingSource) and autogeneratecolumns set to true so I guess everything is default but still the column headers are not clickable. They are like standard labels. SqlCeResultSet rs = functionThatReturnsAResultSet(); this.dataGridView1.AutoGenerateColumns = true; this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.bindingSource1.DataSource = rs; this.dataGridView1.DataSource = this.bindingSource1; I confirm column headers are not clickable.

        X 1 Reply Last reply
        0
        • T Tony Pottier

          set RowHeadersVisible property to false, and to resize it, DGV have a property named RowHeadersWidth Thank you! what you wanna say ?? default is clickable Well I'm feeding my datagridview with a SqlCeResultSet (through a BindingSource) and autogeneratecolumns set to true so I guess everything is default but still the column headers are not clickable. They are like standard labels. SqlCeResultSet rs = functionThatReturnsAResultSet(); this.dataGridView1.AutoGenerateColumns = true; this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.bindingSource1.DataSource = rs; this.dataGridView1.DataSource = this.bindingSource1; I confirm column headers are not clickable.

          X Offline
          X Offline
          Xmen Real
          wrote on last edited by
          #4

          try this :

          DGV.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic;

          TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

          T 1 Reply Last reply
          0
          • X Xmen Real

            try this :

            DGV.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic;

            TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

            T Offline
            T Offline
            Tony Pottier
            wrote on last edited by
            #5

            Still no difference. I'm investigating on it but I can't find any help. Could this be a problem with SqlCeResultSet or the fact that I have an "ORDER BY" statement in my SQL query giving the ResultSet?

            X 1 Reply Last reply
            0
            • T Tony Pottier

              Still no difference. I'm investigating on it but I can't find any help. Could this be a problem with SqlCeResultSet or the fact that I have an "ORDER BY" statement in my SQL query giving the ResultSet?

              X Offline
              X Offline
              Xmen Real
              wrote on last edited by
              #6

              i think its cause is binding, you have bound the DGV

              TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

              T 1 Reply Last reply
              0
              • X Xmen Real

                i think its cause is binding, you have bound the DGV

                TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                T Offline
                T Offline
                Tony Pottier
                wrote on last edited by
                #7

                I see. I've tryed to recreate a new DGV and fill it with a simple "SELECT * FROM" query but still got the same results. Is there any way to make the column clickable even though data is bound (so I could handle the "ColumnClick" events) ? In fact, I've tried to add a HeaderMouseClick event to my DGV and it's handled properly, but still the headers don't act like they're clickable (ie: they act like labels, not buttons).

                X 1 Reply Last reply
                0
                • T Tony Pottier

                  I see. I've tryed to recreate a new DGV and fill it with a simple "SELECT * FROM" query but still got the same results. Is there any way to make the column clickable even though data is bound (so I could handle the "ColumnClick" events) ? In fact, I've tried to add a HeaderMouseClick event to my DGV and it's handled properly, but still the headers don't act like they're clickable (ie: they act like labels, not buttons).

                  X Offline
                  X Offline
                  Xmen Real
                  wrote on last edited by
                  #8

                  dunno :doh: , i will suggest you to add rows manually

                  TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                  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