Groups | Blog | Home
all groups > dotnet general > december 2003 >

dotnet general : Combobox selected index


faisalsns
12/18/2003 11:16:43 PM
Hi,
I am facing a peculiar problem in setting the selected index 9 of a customised combo programitically. For rest of the index it gets set but for the index 9 i.e element no 10 in the datatable it doesnt.

ie if i set it combo.SelectedIndex = 4, the selectedindex gets selected to 4
but if i say combo.SelectedIndex = 9, the selectedindex is still 4(reverts back to the previous entry).

I have tried by adding data row by row instead of the regular DataSource.

Can i find some help...

Regards
Faisal.

---
sandman
12/19/2003 6:09:30 AM

[quoted text, click to view]
index 9 of a customised combo programitically. For rest of
the index it gets set but for the index 9 i.e element no
10 in the datatable it doesnt.
[quoted text, click to view]
from .NET's Largest Community Website:
http://www.dotnetjunkies.com/newsgroups/
[quoted text, click to view]

ComboBox indices are 0-based, so if you only have 8 items
in the list, item 9 won't exist. That might be one
reason. The other thing I noticed is that there is
ComboBox property called MaxDropDownItems. I'm not sure if
this affects how many items you can put in the list or if
it's just the number that show. But you should check that
out too. Maybe experiment with it and see what happens if
Jared
12/19/2003 8:10:38 AM
Faisal,
Your code works fine for me. Try to catch an exception, setting the
combobox's selectedindex property is not giving me any problems at all.
Could you post your code, and mabye where it's being called from?
Jared

[quoted text, click to view]
customised combo programitically. For rest of the index it gets set but for
the index 9 i.e element no 10 in the datatable it doesnt.
[quoted text, click to view]
Community Website: http://www.dotnetjunkies.com/newsgroups/

AddThis Social Bookmark Button