Add control to listview
-
hi friends & all seniors, i have created a user control. i want to add it dynamically to list view. for certain criteria i am saying for(certain condition) listview.control.add(object_of_createdUserControl); If i am using this for flow layout panel it works fine. but this fails for list view. i dont get any error and all the objects of user control are added to the listview but only the first is displayed. hope i have stated my problem correctly :-D Looking forward for your kind response!! Regards Samir
-
hi friends & all seniors, i have created a user control. i want to add it dynamically to list view. for certain criteria i am saying for(certain condition) listview.control.add(object_of_createdUserControl); If i am using this for flow layout panel it works fine. but this fails for list view. i dont get any error and all the objects of user control are added to the listview but only the first is displayed. hope i have stated my problem correctly :-D Looking forward for your kind response!! Regards Samir
Did you check the Location property of your newly added user controls? Perhaps they are all at the same place, and hence only one of them appears on the screen.
-
hi friends & all seniors, i have created a user control. i want to add it dynamically to list view. for certain criteria i am saying for(certain condition) listview.control.add(object_of_createdUserControl); If i am using this for flow layout panel it works fine. but this fails for list view. i dont get any error and all the objects of user control are added to the listview but only the first is displayed. hope i have stated my problem correctly :-D Looking forward for your kind response!! Regards Samir
In general if you want to add multiple controls to a Listview then you need to produce a custom list view control derived from ListView. Check out this link C# Listview 1.3