DataGridView processing at run time

  • Thread starter Thread starter GaryDean
  • Start date Start date
G

GaryDean

I have a DataGridView on a form that will be required to show data from many
different datasources so everything has to be done at run time. Primarily
it will be bound by methods that return DataTables. I also need to create
controls in some of the columns such as a combobox.

I find docs that talk around this but no how-tos yet that tell, for
instance, what events should be used to put a control into a cell in the
DataGrid.

Is there any material that covers this area?
 
Hi Gary,

If you'd like to use ComboBox in a DataGridView, you could use
DataGridViewComboBoxColumn. When the application is run and a cell in the
DataGridViewComboBoxColumn is in edit mode, a combobox is hosted in the
cell for editing value.

FYI, DataGridView provides several kinds of columns, listed as follows:
DataGridViewButtonColumn
DataGridViewCheckBoxColumn
DataGridViewComboBoxColumn
DataGridViewImageColumn
DataGridViewLinkColumn
DataGridViewTextBoxColumn

If you want to host other editing controls in DataGridView cells, you may
implement the IDataGridViewEditingControl interface for the editing
control, and then create a custom DataGridViewCell and DataGridViewColumn.

For more information on how to host controls in DataGridView cells, please
read the following MSDN document:
'How to: Host Controls in Windows Forms DataGridView Cells '
http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx

Hope this helps.
If you have any question, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top