How to add combo box in ListView


AOA, All…. if you want to add a combo box in listview…. you have to use the bound property of listview item to get the rectangular height of the combo box, here is the code which is tested and is correct…. You need a listview named listview1 with only one column
 
You will need to add some item in the listview1 (can be added at runtime or at design time)
 
For each listviewitem as listviewitem in listview1.items
Dim Combo as new combobox
combo.items.add("Ahmed Muneeb is good Programmer")
combo.dropdownstyle = dropdownlist
combo.height=item.bounds.height
combo.location= new point(item.bounds.right,item.bounds.y)
listview1.controls.add(combo)
next
 
Check it out it really work
 
 
Advertisements

6 Comments

  1. jerome dela cruz

    can you please elaborate the code? i need to have this badly. i search google and google but no luck. have tried lots of tutorials but still with no luck :(

  2. You need this event…

    protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
    combobox Combo = new combobox();
    Combo.items.add(“Ahmed Muneeb is good Programmer”);
    Combo.dropdownstyle = dropdownlist;
    Combo.height = item.bounds.height;
    Combo.location = new point(item.bounds.right, item.bounds.y);
    listview1.controls.@add(Combo);
    }

    I wrote it without using VS… So you can fix the syntax issues… :$

  3. I want to have a listview of many columns and in each columns i want to have a combobox.
    Can you help me to do this.
    I looked for it but without succes.
    Thx for helping

  4. the contents of each combobox comes from a database

  5. Lolo

    Now working

  6. shrikant

    no i wan to add a combo box in listview as a subitem but in every row..please help as soon as possible

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: