tags:

views:

1339

answers:

2

I would like to add a DataGridViewTextBoxCell cell to a DataGridViewCell control, but as well as being able to type in the text cell as normal it must also contain a '...' button that once clicks brings up the OpenFileDialog window to allow the user to select a file. Once selected, the text cell will be populated with the full file path.

What is the best way to go about this?

Thanks

+1  A: 

This MSDN article explains how to add a custom control to a DataGridView

You should be able to make a UserControl that has a textbox and button on it and embed that in the DataGridView.

Cameron MacFarland
A: 

You will need to create your own column and cell classes in order to do this. I would suggest using .NET Reflector to look at the implementation details of the DataGridViewTextBox as a starting point and then customizing to add display of a button at the end of it. Check out these tutorials to get started...

MSDN Article

MSDN Reference

Phil Wright