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. Use a ComboBoxCell to update textboxcell on a Binded Datagridview

Use a ComboBoxCell to update textboxcell on a Binded Datagridview

Scheduled Pinned Locked Moved C#
helpannouncement
6 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.
  • O Offline
    O Offline
    olibara
    wrote on last edited by
    #1

    Hello I'm trying to figure out the best way to update TextBoxCell value on a Binded Datagridview The values comes from a list of +/- 1000 allowed value The Dgv is Binded to a datatable I think that it will be too heavy and not necessary to create a ComBoBox column for that dgv But I do not find many information about the use of a single Combobox cell to display "on the fly" when editing a TextBoxCell Thank for any Help N.B. : For now I'm using a ContextMenu with a ComBobox Item

    H 1 Reply Last reply
    0
    • O olibara

      Hello I'm trying to figure out the best way to update TextBoxCell value on a Binded Datagridview The values comes from a list of +/- 1000 allowed value The Dgv is Binded to a datatable I think that it will be too heavy and not necessary to create a ComBoBox column for that dgv But I do not find many information about the use of a single Combobox cell to display "on the fly" when editing a TextBoxCell Thank for any Help N.B. : For now I'm using a ContextMenu with a ComBobox Item

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

      Even if you find a suitable way of showing a ComboBox 'on the fly' I suspect that the time taken to load the +/- 1000 options will be at least as great (as heavy), if not greater than the time taken when using a DataGridViewComboBoxColumn. From this point of view I cannot see why you do not use a ComboBox column. Or is there some other reason?

      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.”

      O 1 Reply Last reply
      0
      • H Henry Minute

        Even if you find a suitable way of showing a ComboBox 'on the fly' I suspect that the time taken to load the +/- 1000 options will be at least as great (as heavy), if not greater than the time taken when using a DataGridViewComboBoxColumn. From this point of view I cannot see why you do not use a ComboBox column. Or is there some other reason?

        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.”

        O Offline
        O Offline
        olibara
        wrote on last edited by
        #3

        Thank You Henry To be honest I've very little experience about using ComboBox on a DataGridView I know that it can be tricky and I don't really know when a ComboBoxCell is suitable instead of a ComboBoxColumn But the constraints here are - The DGV is Binded and normaly I use the AutoGenerate Column - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited - There is only ONE List for the Combo

        H 2 Replies Last reply
        0
        • O olibara

          Thank You Henry To be honest I've very little experience about using ComboBox on a DataGridView I know that it can be tricky and I don't really know when a ComboBoxCell is suitable instead of a ComboBoxColumn But the constraints here are - The DGV is Binded and normaly I use the AutoGenerate Column - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited - There is only ONE List for the Combo

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

          A ComboBoxColumn is made up of ComboBoxCells so to get a ComboBoxCell all you have to do is set that Column to be a ComboBoxColumn. Here[^] is a sample using a ComboBoxColumn, work through it and see if it is anywhere near your requirements. Pretty much anything that can be done in code can be done through the designer for DataGridViews. Look here[^] for an example.

          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.”

          1 Reply Last reply
          0
          • O olibara

            Thank You Henry To be honest I've very little experience about using ComboBox on a DataGridView I know that it can be tricky and I don't really know when a ComboBoxCell is suitable instead of a ComboBoxColumn But the constraints here are - The DGV is Binded and normaly I use the AutoGenerate Column - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited - There is only ONE List for the Combo

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

            I have realized that I haven't answered your other points, I didn't really see them because I thought they were your sig. :)

            olibara wrote:

            - The DGV is Binded and normaly I use the AutoGenerate Column

            Using the 'Data Sources Window' you can set individual database columns to use specific types of DataGridViewColumns. By expanding the tree so that you can see the column of interest, make sure that your form is selected in the designer, go back to Data Sources and select the the column. It should display as a combobox which will list the types of controls that can be used, select the combobox option and away you go. When you drag the DataSource onto your form it will make a grid with a comboboxcolumn.

            olibara wrote:

            - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited

            The ComboBoxColumn looks like a TextBoxColumn until you edit/select it.

            olibara wrote:

            - There is only ONE List for the Combo

            That is normal.

            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.”

            O 1 Reply Last reply
            0
            • H Henry Minute

              I have realized that I haven't answered your other points, I didn't really see them because I thought they were your sig. :)

              olibara wrote:

              - The DGV is Binded and normaly I use the AutoGenerate Column

              Using the 'Data Sources Window' you can set individual database columns to use specific types of DataGridViewColumns. By expanding the tree so that you can see the column of interest, make sure that your form is selected in the designer, go back to Data Sources and select the the column. It should display as a combobox which will list the types of controls that can be used, select the combobox option and away you go. When you drag the DataSource onto your form it will make a grid with a comboboxcolumn.

              olibara wrote:

              - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited

              The ComboBoxColumn looks like a TextBoxColumn until you edit/select it.

              olibara wrote:

              - There is only ONE List for the Combo

              That is normal.

              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.”

              O Offline
              O Offline
              olibara
              wrote on last edited by
              #6

              Thank you Henri I'm sorry to reply so late but I did'nt get the notification of your reply I will investigate because using the Combobox directly in the DGV is far better than my actual solution to set the ComboBox in a contextMenu It is not easy to find good explaination about the different way to use a combobox in a datagridview

              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