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. Windows Forms
  4. DataGridView "not always"/sometimes adjusting row height for wordwrap

DataGridView "not always"/sometimes adjusting row height for wordwrap

Scheduled Pinned Locked Moved Windows Forms
4 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.
  • S Offline
    S Offline
    sa_blackmon
    wrote on last edited by
    #1

    I have a datagridview bound to a bindingsource bound to a List<>. The datagridview is sitting on a tabpage; the bindingsource is bound to the List<> while the tabpage is not current. Then, when the tabpage is made current, i.e., is made visible, the text that overflows a single line in the datagridview is wrapped but the rowheight is not adjusted for the second and subsequent lines of text. On the other hand, if the bindingsource is bound while the datagridview is visible, the rowheight is set correctly. I realize I can wait till the tabpage is current/visible to bind the bindingsource, but it just doesn't seem that should be required. Thanks in advance.

    Snerril Blackmon

    H 1 Reply Last reply
    0
    • S sa_blackmon

      I have a datagridview bound to a bindingsource bound to a List<>. The datagridview is sitting on a tabpage; the bindingsource is bound to the List<> while the tabpage is not current. Then, when the tabpage is made current, i.e., is made visible, the text that overflows a single line in the datagridview is wrapped but the rowheight is not adjusted for the second and subsequent lines of text. On the other hand, if the bindingsource is bound while the datagridview is visible, the rowheight is set correctly. I realize I can wait till the tabpage is current/visible to bind the bindingsource, but it just doesn't seem that should be required. Thanks in advance.

      Snerril Blackmon

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      You could try using the BindingSource.ResetBindings() when the DGV becomes visible. This will cause it to reset its data and display.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      S 1 Reply Last reply
      0
      • H Henry Minute

        You could try using the BindingSource.ResetBindings() when the DGV becomes visible. This will cause it to reset its data and display.

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

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

        Henry, Charming solution. I had tried the BindingSource.ResetBindings()in several events but (silly me) I had never put it in the VisibleChanged event. I appreciate you. Sherril

        H 1 Reply Last reply
        0
        • S sa_blackmon

          Henry, Charming solution. I had tried the BindingSource.ResetBindings()in several events but (silly me) I had never put it in the VisibleChanged event. I appreciate you. Sherril

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          My pleasure. :)

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” Why do programmers often confuse Halloween and Christmas? Because 31 Oct = 25 Dec.

          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