PC Review


Reply
Thread Tools Rate Thread

Combobox selected index

 
 
faisalsns
Guest
Posts: n/a
 
      19th Dec 2003
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.

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
 
Reply With Quote
 
 
 
 
sandman
Guest
Posts: n/a
 
      19th Dec 2003

>-----Original Message-----
>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.
>
>---
>Posted using Wimdows.net NntpNews Component - Posted

from .NET's Largest Community Website:
http://www.dotnetjunkies.com/newsgroups/
>.


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
you change it to 10.
 
Reply With Quote
 
Jared
Guest
Posts: n/a
 
      19th Dec 2003
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

"faisalsns" <faisalsns@-NOSPAM-yahoo.com> wrote in message
news:#(E-Mail Removed)...
> 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.
>
> ---
> Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest

Community Website: http://www.dotnetjunkies.com/newsgroups/


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the index of the current selected line in ComboBox/ListBox bbnimda Microsoft Outlook Form Programming 1 25th Jan 2008 11:43 AM
set selected index of a ComboBox Steffen Laser Microsoft C# .NET 9 19th Aug 2004 03:27 PM
Programmatically determining selected index of combobox produces null error =?Utf-8?B?cG9seW5vbWlhbDVk?= Microsoft ADO .NET 2 17th May 2004 09:01 AM
Set selected index in ComboBox Steve Microsoft VB .NET 0 18th Feb 2004 05:18 PM
Combobox selected index changes when dataset changes Paul Microsoft ADO .NET 0 13th Aug 2003 03:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:49 AM.