none
ellipsis button on a DataGridView cell

    Question

  • I know I am missing something simple. . .

    I have an unbound column on a DataGridView. I want it to display some data derived from a non-visible key field of the dataTable the Grid is bound to. I want an ellipsis button on the text box, so the user can open a form to define the data that wll be set in the key field, then I will update the Unbound column.

    Does that make sense? am I going about this the wrong way?

    Wednesday, January 04, 2006 7:40 PM

Answers

All replies

  • Not sure what you are going for. Can you give a slightly more concrete example?
    Wednesday, January 04, 2006 7:44 PM
  • an example in visial studio is,

    drop a DataGridView on a form and on the Properties tab, property grid for it, select the Columns property . . . see the little button to the right [...]

    I want to do something similar in my form's grid.

    GridColumn1   GridColumn2    GridColumn3      
    DataCol1      DataCol2       DerivedData [...]

    DerivedData is derived from DataCol3. clicking the ellipsis pops up a form that is used to find a piece of data that will be pushed into DataCol3.

    Make sense?

     

    Wednesday, January 04, 2006 8:00 PM
  • Ah. I havent had much time to look at DataGridViews yet, but what I have done in the past with DataGrids is override DataGridColumnStyle with a custom class that would implement this functionality. It would show the ellipsis button when the cell goes into edit mode and hide it when the cell goes out of edit mode. The button click event would fire a popup form which would allow the user to select the data, and then that data would be set as the data for the column cell. You can do something similar with combo-boxes, if you dont need a whole pop-up form. Its not exactly simple, but its not too terribly complicated either.
    Wednesday, January 04, 2006 9:12 PM
  • Yeah, I was just thinking with the fantastic enhancements in the grids in v.2, it might be there.
    Wednesday, January 04, 2006 9:17 PM
  • What CommonGenius mentions is very similar to what you need to do for the DataGridView. Check out http://www.windowsforms.net/blogs/markrideout/FilePathSample.zip for an unsupported sample that has a user control that contains a textbox and a "..." button.

     

    -mark

    DataGridView Program Manager

    Microsoft

    This post is provided "as-is"-mark

     

    Wednesday, January 04, 2006 11:42 PM
  • cool. . . thanks!
    Thursday, January 05, 2006 12:05 AM
  • Mark,

    Very nice implementation of the textbox and a button.
    How would you make the button visible all the time?

    Thanks,

    Buster95

    Thursday, August 03, 2006 12:50 PM
  • Hey, this is what i want but i cant open it because is CSharp im using VB.net express 2005. Anyone have the vb version?
    Saturday, May 26, 2007 8:05 AM
  • You can convert the code to VB fairly easily. There's probably other tools out there or more elegant ways to do it, but I did it by loading the assembly into Lutz Roeders .NET reflector and using the FileDisassembler add-in to decompile it into VB code. It is because all .NET languages compile down into the same IL code that this is possible. Hope this helps.
    Thursday, May 31, 2007 11:16 AM
  •  

    Hi,

    The post was quite helpful. But, I will need one additional stuff.

    When I am in the textbox within a particular cell, I am clicking Enter (the cell is in edit mode).

    I want the pressing of Enter button to trigger an event that will fire the click event of the button that is hosted within the cell.

    Before firing the click event, the contents of the textbox within the cell will be validated... and if founc=d invali, then the button click will not be executed and appropriate error message will be displayed.

     

    Can anyone please help me with some code snippet for solving this situation.

     

    Thanks in advance,

    jads

    Wednesday, October 29, 2008 9:25 AM
  • Hi Mark,

     

    I've tried the sample program that you've posted. Thanks! it really helped me in what i need to do.

    But my problem now is, in the code, the input of the user will be assigned to the textbox like so:

     

    Code Snippet

    dr = openFileDialog1.ShowDialog();

    if (dr == DialogResult.OK)

    this.filePathTextBox.Text = openFileDialog1.FileName;

     


    what I want to do, is get the value from the text box and use that value in my DatagridView.  I’m using the custom column in a DataGridView, and I want the value in the textbox to be assigned to the bindingsource in datagridview. How will i do that? 


    Thanks!

    Chesca

    Tuesday, November 18, 2008 10:21 AM
  • This is a rather old post but I'm wondering if there is any way to create a custom control like the one mentioned above that is displayed all of the time, not only in edit mode.  I would like the ellipsis button displayed all the time in the cell and don't want the user the ability to edit the textboxcontrol, that will be filled from the result of the form that is popped up using the ellipsis button.

     

    Thanks!

    Friday, August 19, 2011 8:08 PM