Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid combobox

Status
Not open for further replies.

VasaCheh

Technical User
Joined
Feb 19, 2003
Messages
8
Location
US
Is there in .net framework some way to get a combobox (box w/ drop-down list) in datagrid cell for Windows forms? Some control or some method of the DataGrid control?
How to resolve the situation with combobox??
 
You can add a combo box (or checkbox etc) dynamically to a data grid by adding the combobox to the textbox that is present by default.

Try this -

DataGridTextBoxColumn dgTextBox = (DataGridTextBoxColumn)dgdDataGrid.TableStyles[0].GridColumnStyles[0];
dgTextBox.TextBox.Controls.Add (cmbComboBox);

Kev
 
I have done this and I am not sure what I am doing wrong. Everything appears to be working ok, but I never see the combobox appear when enter the textbox of the grid I associated it to. What I am doing wrong or am I misunderstanding the functionality of this thread? I would have expected the combobox to become active in this cell.

Thank You,
Mike
 
This is working fine in an application I've written, only thing I can think of is namespaces. I'm using these -

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Text;

Kev
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top