473,503 Members | 9,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combobox selected index

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/
Jul 21 '05 #1
2 4790
-----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 4but 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.
Jul 21 '05 #2
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:#D**************@TK2MSFTNGP09.phx.gbl...
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/
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2181
by: hasden | last post by:
I'm working in .NET and I can't seem to get the behavior that I need from the combobox. I'm sure it's possible, I just don't have the .NET experience. Any help would be greatly appreciated. I need...
4
9083
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
9
56500
by: Steffen Laser | last post by:
Hi group, I have a problem that I already have posted to the german C# newsgroup. Since nobody could help me there, I'd like to try it here again: I set the selected item of a combobox like...
2
10240
by: farseer | last post by:
Hi, I have a combobox who's data source i set to an array of objects (call it MyObject). these objects have get properties: key, value, descr. i set ValueMember to "key", DisplayMember to...
9
4138
by: Strahimir Antoljak | last post by:
Could anyone help me with the following: Is there a quick, or at least known way to force a ComboBox, having DropDownStyle= DropDownList, to recognize keyboard input and perform Item selection...
5
2133
by: ross kerr | last post by:
Hi All, I am extending the combobox to create a control that selects an item based on the text the user is typing into the text area of the control. I have an issue that occurs only when i...
5
9149
by: Eric A. Johnson | last post by:
Hi Everyone, I am at my wit's end here. I have a combobox (combyQueryTitle) that I need to use in order to select a query for my database project. Therefore, I am using the...
5
2225
by: Nadav | last post by:
Hello. I have a combobox in a form (cmbNames). The DataSource property is some arraylist of strings. I have a button which is supposed to "clean" the combobox and deselect any item. Therefore, I...
0
1441
by: lsharva | last post by:
Actually, i m working on Windows Application where i have to use the ComboBox and listview in a way , as first we will click the comboBox and then as you click , ListView appear and when we...
2
3666
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.