473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 4787
-----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
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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,...

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.