473,809 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combobox index

1 New Member
hi group..
i want to store all my combobox's indexes into an array....what coding should i do??plz help...
Apr 11 '12 #1
2 1841
michaeldebruin
134 New Member
I am not sure, but using the following line might be usefull to you. Atleast if this is what you are looking for.

<name of your combobox>.items and then use a foreach loop to create a new array foreach item.
Apr 11 '12 #2
Subin Ninan
91 New Member
Below code can be used for copying combobox items in an array.
Expand|Select|Wrap|Line Numbers
  1. string[] strArray = new string[comboBox1.Items.Count];
  2. for (int i = 0; i < comboBox1.Items.Count; i++)
  3. {
  4.     strArray[i] = comboBox1.Items[i].ToString();
  5. }
  6.  
Apr 12 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2618
by: Strahimir Antoljak | last post by:
Has anyone experienced problems with a combo box SelectIndex property? Is there a limit to the number of Items for a combo box? Namely, when I set programmatically ComboBox.SelectIndex property with 2000 Items listed in the ComboBox, SelectIndex property accepts assigned value. However, when I try to use SelectIndex
4
4623
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
5
9167
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 inexplicably start with the ..selectedindex property at -1! This makes no sense to me. ...
2
2818
by: wallermj | last post by:
I want to be able to compare the old combobox index to the newly selected combobox index in the SelectIndexChanged event. How can I do that? I know I could store the last selected value for the combobox myself and compare that to the new index in the SelectIndexChanged event, but doesn't VB.Net store this value somewhere so I don't have to?
5
2235
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 is no selected item.
0
1079
by: nedier26 | last post by:
Hi everyone, I have a control array that contains two ComboBox and I used a Select Case to make the difference between the ComboBox and I also diferentiate the two ComboBox using their Index value. The problem is that when I run my program I can not see the values that are in the second ComboBox (Index 1) but I can see the values that are in the first ComboBox (Index 0). I have to click on the first ComboBox and then click on the second so I...
5
6790
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I want to create a customized ComboBox where the methods ComboBox.Items.Add and ComboBox.Items.Insert will behave thusly: -- If the item is not present, add it. -- If the item is present, set the selected index to the item (without adding a duplicate). I know the basics of inheriting from user controls, so if this was merely overriding a method of ComboBox I could do it. But how does one go about overriding a method of the Items...
2
3442
by: TomasART | last post by:
Hi All, At first i will give thanks of all who have help me in the other thread. Know my combo works :). Ok, you know the combo calls a javascript function in the onchage statement. $combo = "<select name=\"ta\" id=\"ta\" class=\"imputbportada\" WIDTH=\"170\" STYLE=\"width: 170px\" onChange=\"cambia(document.formComprar.Q1,this.val ue)\">\n"; If i try to select a default option, but the onchange don't call the function.
0
1254
by: =?Utf-8?B?Y2xhcmE=?= | last post by:
Hi all, I use ComboxBoxes to input and display lookup field values in a database table. I want to use the value in database as the index of the items in a ComboBox so the matching items will be displayed when a record is read.To boolean value, it starts from 0, for other enums, they start from 1, so I have to do adjustment in code, is it possible to configure a combobox' index base instead ? Clara
5
18784
by: Kevinp | last post by:
I've spent the last four hours Google searching for a way to disable items in a Combobox. I found one example in C++ which I can't get to work and another in C# that I couldn't get to work either. Does anyone have some good code for an owner-drawn combobox?
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10387
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7662
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.