| | |
Adding controls into a ListView
![]() |
Greetings.
Right, I have came up with a few lines of codes.
I have 6 rows in the listview, and I need to add 1 comboBox to each row at subItem number 2.
At runtime, I could see 1 comboBox at row 1.
I guess all 6 combo boxes are piled up there.
How can I solve that? Please help.
Thanks.
Right, I have came up with a few lines of codes.
I have 6 rows in the listview, and I need to add 1 comboBox to each row at subItem number 2.
At runtime, I could see 1 comboBox at row 1.
I guess all 6 combo boxes are piled up there.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Do Until myRS.EOF = True Set objItem = listviewEIP.ListItems.Add(, "A" & myRS!com_code, myRS!com_name) objItem.SubItems(1) = "Something" objItem.SubItems(3) = "Anything" myRS.MoveNext Loop comboID(0).Visible = False With listviewEIP.ColumnHeaders Load comboID(1) Call fillCombo(1) comboID(1).Top = listviewEIP.ListItems.Item(1).Height comboID(1).Left = .Item(3).Left comboID(1).Width = .Item(3).Width comboID(1).Visible = True SetParent comboID(1).hWnd, listviewEIP.hWnd comboID(1).ZOrder For i = 2 To 6 Load comboID(i) fillCombo (i) comboID(i).Top = listviewEIP.ListItems.Item(i - 1).Height comboID(i).Left = .Item(3).Left comboID(i).Width = .Item(3).Width comboID(i).Visible = True SetParent comboID(i).hWnd, listviewEIP.hWnd comboID(i).ZOrder Next i End With
How can I solve that? Please help.
Thanks.
"Study the past if you would define the future" - Confucius
•
•
Join Date: Jul 2004
Posts: 17
Reputation:
Solved Threads: 0
Well, looks like you have the right idea for the SetParent API. In all honesty, I've never tried adding controls to a list view or anything else that has multiple places to put them (aside from a toolbar, but that's slightly different).
You might try to find a way to address subItem2's handle. Every control in Windows has a control (or atleast has the opportunity to apply for one). If you want to think about it in a very basic concept, imagine everything is a picturebox, except not everything has a Picture property. From there, you can see that everything has a Height, Width, and Handle. Beyond that, the controls just add their own properties as needed.
So if you can find a way to retrieve subItem2's hWnd, then you should be in business.
You might try to find a way to address subItem2's handle. Every control in Windows has a control (or atleast has the opportunity to apply for one). If you want to think about it in a very basic concept, imagine everything is a picturebox, except not everything has a Picture property. From there, you can see that everything has a Height, Width, and Handle. Beyond that, the controls just add their own properties as needed.
So if you can find a way to retrieve subItem2's hWnd, then you should be in business.
Greetings.
Ok, I got you.
By the way, I could not fully understand wat does hWnd do.
Could you please explain a little if possible?
In addition, I tried using the combo box's Height property but there is an error stating that combo box's height is read-only, n thus I can't use that parameter to do things with it. I'm not modifying the parameter, but I just want that value.
Please advise.
Ok, I got you.
By the way, I could not fully understand wat does hWnd do.
Could you please explain a little if possible?
In addition, I tried using the combo box's Height property but there is an error stating that combo box's height is read-only, n thus I can't use that parameter to do things with it. I'm not modifying the parameter, but I just want that value.
Please advise.
"Study the past if you would define the future" - Confucius
•
•
•
•
Originally Posted by red_evolve
Greetings.
Ok, I got you.
By the way, I could not fully understand wat does hWnd do.
Could you please explain a little if possible?
In addition, I tried using the combo box's Height property but there is an error stating that combo box's height is read-only, n thus I can't use that parameter to do things with it. I'm not modifying the parameter, but I just want that value.
Please advise.
Mark Nemtsas
Time and Billing Software - Time Tracking Software - Roller Shutters - Roller Blinds -
Baby Books
Time and Billing Software - Time Tracking Software - Roller Shutters - Roller Blinds -
Baby Books
•
•
Join Date: Jul 2004
Posts: 17
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by red_evolve
Greetings.
Ok, I got you.
By the way, I could not fully understand wat does hWnd do.
Could you please explain a little if possible?
Greetings.
Thanks for the url, mnemtsas! Can't really get what you meant by this though:-
Well, I've browsed thru vbaccelerator , I found something about subclassing.
[1] Add a Check Box to the Left Hand Side of a Drop-Down Combo Box (Currently looking into this as I guess the concept is quite similar.)
[2] Detect when a Combo Box Drops Down or Closes Up (This is indeed very confusing for me!)
Cypher, thanks a lot for the explanation! Understood, but now's time to apply the theory (toughest part!
).
Thanks for the url, mnemtsas! Can't really get what you meant by this though:-
•
•
•
•
In fact I'd be amazed if his freely downloadable enhanced listview didn't already do exactly what you want.
[1] Add a Check Box to the Left Hand Side of a Drop-Down Combo Box (Currently looking into this as I guess the concept is quite similar.)
[2] Detect when a Combo Box Drops Down or Closes Up (This is indeed very confusing for me!)
Cypher, thanks a lot for the explanation! Understood, but now's time to apply the theory (toughest part!
). "Study the past if you would define the future" - Confucius
![]() |
Similar Threads
- adding data to listview (VB.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Users Saving Games?
- Next Thread: Primary Key Issue
| Thread Tools | Search this Thread |
* 6 2007 access activex add age basic beginner birth bmp calculator cd cells.find click client code college connection connectionproblemusingvb6usingoledb creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit excel excelmacro file filename form header iamthwee image inboxinvb internetfiledownload listbox listview liveperson login looping microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading remotesqlserverdatabase report save search sendbyte sites sql sql2008 sqlserver subroutine tags time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web windows






