473,569 Members | 2,759 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.SelectedI ndex = 4, the selectedindex gets selected to 4
but if i say combo.SelectedI ndex = 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 4800
-----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.SelectedI ndex = 4, the selectedindex gets selected to 4but if i say combo.SelectedI ndex = 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 MaxDropDownItem s. 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******** ******@TK2MSFTN GP09.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.SelectedI ndex = 4, the selectedindex gets selected to 4 but if i say combo.SelectedI ndex = 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
2191
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 a combobox with the following behavior: - The user can type in any text they want - When the user clicks the drop down button and selects an item...
4
9090
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 if the item is the currently selected one. I have selected a blue (SystemColors.Highlight) background brush and white (SystemColors.HighlightText)...
9
56506
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 this: myCombo.SelectedItem = 3; But after that the ComboBox displays only the first entry of the list. When I add the line
2
10247
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 "descr", and datasource to the array of MyObjects. How can i set the selected value of that combobox based on the ValueMember OR how can i find the...
9
4140
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 based on that. To be more specific: I have a list of 150 items (all 7-digit numeric values) represented in the combobox, and they are sorted....
5
2139
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 drop down the combo box as the users typing. When the on leave event is fired the value in the selected
5
9152
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 comboQueryTitle_SelectedIndexChanged handler to, when a new selection is made, update the query and refresh the display. The only problem is that the program seems to...
5
2229
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 do: cmbNames.SelectedIndex = -1; If index 0 was selected (meaning, the first item on the list) - the combobox indeed goes to index -1 and there...
0
1445
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 select something , that will be selected at comboBox also and ListView will disappear, and comboBox item should get selected. Here i m having a problem as...
2
3671
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 different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7672
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6283
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.