ListView and ComboBox

newForumUser

Member
Joined
Feb 21, 2008
Messages
5
Programming Experience
Beginner
Hi,

I have been trying to display a combobox for each row in a listview. the combobox is populated from a table in a database and and the listview itself is populated by another table in the same database.

I simply cannot get the combobox to display in the listview(it displays it in the header for some reason and not at the end of each row, which is what I want).

I gave up on the datagrid, it was way too complicated for something simple(is there a simple way to to do what I am trying to in a ListView with a DataGrid?)

any help will be great.

thanks
 
I declared this:

Private Declare Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Long

Private Declare Function MoveWindow Lib "user32" (ByVal hWndChild As IntPtr, ByVal X As Int32, ByVal Y As Int32, ByVal width As Int32, ByVal height As Int32, ByVal repaint As Boolean) As Long


as described in msdn. and did a :

SetParent(cmb.Handle, ListView1.Handle)

it does show up where I want it to ..but it is not quite a part of the ListView...for instance, if I do a ListView.Columns.clear()..the rest of the column names I declared go away but not the ComboBox.

I really wanna add the comboBox as a ListViewItem.
 
You're using a really old VS (2002), there are free VS2005/Net2.0 and VS2008/Net3.5 available. You still can't do anything more with Listview, but with DataGridView control it is easy. With the old DataGrid it is more complicated as you say, but you can try KDNGrid Class.
 
Back
Top