CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009

    Cool Making a DataGridView table that is full of ComboBox's... possible? (Y/N)

    Here's my vision:

    Around 30 ComboBox's (let's say 6 rows and 5 columns) and they are all in a DataGridView, so I can use some of the features of the datagridview.

    I saw (accidentally) how it's possible to have checkboxes in a DataGridView, so I'm pretty certain it's possible to put a ComboBox in there (unless I'm totally wrong), but I'm not sure how.

    Whoever can answer this is a l33t h8x0r extreme. thanks!

  2. #2
    Join Date
    Apr 2005

    Resolved Re: Making a DataGridView table that is full of ComboBox's... possible? (Y/N)

    I managed to incorporate Combo Boxes in a MFC Grid Control (as written by Chris Maunder) (v2.25).

    Here's the relevant code I used:

    #include "GridCtrl_src/GridCtrl.h"
    #include "NewCellTypes/GridCellCombo.h"
    	CGridCtrl m_Grid;
    	DDX_GridControl(pDX, IDC_GRID, m_Grid);
    	CStringArray options;
    	options.Add(_T("Option 1"));
    	options.Add(_T("Option 2"));
    	options.Add(_T("Option 3"));
    	options.Add(_T("Option 4"));
    	m_Grid.SetCellType(j,i, RUNTIME_CLASS(CGridCellCombo));
    	CGridCellCombo *pCell = (CGridCellCombo*) m_Grid.GetCell(j,i);
    I hope this helps you somehow.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.