473,479 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

adding combobox item data

just asking on how to add item data in combobox??

in vb6;

combo1.additem "Item 1"
combo1.ItemData(combo1.NewIndex) = 1
but how about in .net??

Nov 28 '05 #1
6 7986
Kmercer,

In .Net you have two posibilities. Use a datasource or use the itemarray.

With the itemarray which matches the most your question it is simple (watch
typos)

\\\
combo1.items.add("Item 1")
combo.selectedindex = -1
(in version 2002/2003 twice because of a bug).
///

I hope this helps,

Cor
Nov 28 '05 #2
<km*******@yahoo.com> schrieb:
just asking on how to add item data in combobox??


<URL:http://dotnet.mvps.org/dotnet/code/controls/#ItemData>
(ignore the text and take a look at the code)

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 28 '05 #3
Cor, what did you mean by the line:

(in version 2002/2003 twice because of a bug).

I haven't found any bugs yet in the combo box and I've used it a lot.

--
Dennis in Houston
"Cor Ligthert [MVP]" wrote:
Kmercer,

In .Net you have two posibilities. Use a datasource or use the itemarray.

With the itemarray which matches the most your question it is simple (watch
typos)

\\\
combo1.items.add("Item 1")
combo.selectedindex = -1
(in version 2002/2003 twice because of a bug).
///

I hope this helps,

Cor

Nov 29 '05 #4
Dennis,
Cor, what did you mean by the line:

(in version 2002/2003 twice because of a bug).

I haven't found any bugs yet in the combo box and I've used it a lot.


Than you are probably one of the luckiest persons on earth, in my idea is it
the control with the most bugs.

One of those is that the combobox does not react if you set the index one
time to -1, a workaround written somewhere is to set it twice.

I agree that I don't see it as well anymore so maybe it is fixed in the sp1.

Cor
Nov 29 '05 #5
I have vb.net 2003 and framework 1.1 with sp1 and have several apps where I
set comboboxes to -1 routinely and haven't had any problems so it must have
been fixed. I typically use

combobox.Selectedindex = combobox.findstringexact and when it doesn't find
the string, it sets the combobox to -1.
--
Dennis in Houston
"Cor Ligthert [MVP]" wrote:
Dennis,
Cor, what did you mean by the line:

(in version 2002/2003 twice because of a bug).

I haven't found any bugs yet in the combo box and I've used it a lot.


Than you are probably one of the luckiest persons on earth, in my idea is it
the control with the most bugs.

One of those is that the combobox does not react if you set the index one
time to -1, a workaround written somewhere is to set it twice.

I agree that I don't see it as well anymore so maybe it is fixed in the sp1.

Cor

Nov 30 '05 #6
me 2

Dennis wrote:
Cor, what did you mean by the line:

(in version 2002/2003 twice because of a bug).

I haven't found any bugs yet in the combo box and I've used it a lot.

Nov 30 '05 #7

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

Similar topics

3
7459
by: Wayne Wengert | last post by:
I am trying to populate a combobox with a lisy of items. I want the 1st item to be "Make a Selection" and the following items will be names from a table in my DB (See code below). When I run the...
6
3049
by: Mendhak | last post by:
Hi All, When you add an object to a combobox, and run the application, you'll get something like this: System.Windows.Forms.Button, Text: Button1 (for example). Is it possible to have...
2
1978
by: Tark Siala | last post by:
hi in VB6 (Listbox and Combobox) have nice Properties called (Item Data) when i go to VB.NET i can't Find this Properties :( please help me , i want Save tow value in one item in ComboBox 1 -...
0
291
by: rmatteson | last post by:
I am trying to figure out how to clear all items from a combobox (Access 2002). On my form, I have to comboboxes. Combobox 2 is populated with a set of child data dependent on the parent data...
5
4641
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound...
1
1472
by: Sebastian Santacroe | last post by:
Hello, I've got a datagrid with two columns and no data. I want to add data programmically (from DB). When I try to use sintax like: dataset.Tables("Department").Rows(0).Item("Percentage Used")...
10
1894
by: robingSA | last post by:
Hi...I have a number of Combo Boxes on a form. If one types a name which is not in the table, I want it to add the typed, new item. I am using the following code to do this and it works well,...
0
1883
by: marcobx | last post by:
I have a ComboBox and a List of objects to popolate items. I use the DataSource property and not the List collection: List<foolst = new List<foo>; //add elements into the list //......
2
4085
by: spowel4 | last post by:
Here's my code thus far: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim objxmldoc As New Xml.XmlDataDocument() 'Load all customer numbers...
0
6899
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
7019
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,...
1
6719
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...
1
4757
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
2980
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
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
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 ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
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...

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.