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

Home Posts Topics Members FAQ

Problem w/ComboBox

Don
Me.cbxLocation.Items.AddRange(New Object() {"Item0", "Item1", "Item2", "Item3"})
Me.cbxLocation.DropDownWidth = 114
Me.cbxLocation.Location = New System.Drawing.Point(72, 16)
Me.cbxLocation.Name = "cbxLocation"
Me.cbxLocation.Size = New System.Drawing.Size(112, 21)
Me.cbxLocation.TabIndex = 0

'Should return "Item0"
cbxLocation.GetItemText(0) <=returns 0

'Should return "Item1"
cbxLocation.GetItemText(1) <=returns 1

'Should return "Item2"
cbxLocation.GetItemText(2) <=returns 2

'Should return "Item3"
cbxLocation.GetItemText(3) <=returns 3

GetItemText seems to be returning the INDEX of the requested item rather than the item TEXT. What in the world would cause such a thing?

Thanks a lot!

--

Don
Nov 20 '05 #1
3 1442
Don
"Don" <No****@nothanks.com> wrote in message news:eW**************@TK2MSFTNGP09.phx.gbl...
Me.cbxLocation.Items.AddRange(New Object() {"Item0", "Item1", "Item2", "Item3"})
Me.cbxLocation.DropDownWidth = 114
Me.cbxLocation.Location = New System.Drawing.Point(72, 16)
Me.cbxLocation.Name = "cbxLocation"
Me.cbxLocation.Size = New System.Drawing.Size(112, 21)
Me.cbxLocation.TabIndex = 0

'Should return "Item0"
cbxLocation.GetItemText(0) <=returns 0

'Should return "Item1"
cbxLocation.GetItemText(1) <=returns 1

'Should return "Item2"
cbxLocation.GetItemText(2) <=returns 2

'Should return "Item3"
cbxLocation.GetItemText(3) <=returns 3

GetItemText seems to be returning the INDEX of the requested item rather than the item TEXT. What in the world would cause such a thing?

Thanks a lot!

--

Don
Nov 20 '05 #2
Don,

Use this instead !

MessageBox.Show(cbxLocation.Items(1).ToString())

Regards - OHM#
On**********@BTInternet.com
"Don" <No****@nothanks.com> wrote in message news:Ok**************@TK2MSFTNGP11.phx.gbl...
"Don" <No****@nothanks.com> wrote in message news:eW**************@TK2MSFTNGP09.phx.gbl...
Me.cbxLocation.Items.AddRange(New Object() {"Item0", "Item1", "Item2", "Item3"})
Me.cbxLocation.DropDownWidth = 114
Me.cbxLocation.Location = New System.Drawing.Point(72, 16)
Me.cbxLocation.Name = "cbxLocation"
Me.cbxLocation.Size = New System.Drawing.Size(112, 21)
Me.cbxLocation.TabIndex = 0

'Should return "Item0"
cbxLocation.GetItemText(0) <=returns 0

'Should return "Item1"
cbxLocation.GetItemText(1) <=returns 1

'Should return "Item2"
cbxLocation.GetItemText(2) <=returns 2

'Should return "Item3"
cbxLocation.GetItemText(3) <=returns 3

GetItemText seems to be returning the INDEX of the requested item rather than the item TEXT. What in the world would cause such a thing?

Thanks a lot!

--

Don
Nov 20 '05 #3
Don
Thanks for the assist. That did work. I'm still kind of curious why MS says that getItemText will return the text of the specified item (although I don't truly expect anyone here to know the answer).

From the help's ListItem.GetItemText Method entry:
Returns the text representation of the specified item.

--

Don
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Don,

Use this instead !

MessageBox.Show(cbxLocation.Items(1).ToString())

Regards - OHM#
On**********@BTInternet.com
"Don" <No****@nothanks.com> wrote in message news:Ok**************@TK2MSFTNGP11.phx.gbl...
"Don" <No****@nothanks.com> wrote in message news:eW**************@TK2MSFTNGP09.phx.gbl...
Me.cbxLocation.Items.AddRange(New Object() {"Item0", "Item1", "Item2", "Item3"})
Me.cbxLocation.DropDownWidth = 114
Me.cbxLocation.Location = New System.Drawing.Point(72, 16)
Me.cbxLocation.Name = "cbxLocation"
Me.cbxLocation.Size = New System.Drawing.Size(112, 21)
Me.cbxLocation.TabIndex = 0

'Should return "Item0"
cbxLocation.GetItemText(0) <=returns 0

'Should return "Item1"
cbxLocation.GetItemText(1) <=returns 1

'Should return "Item2"
cbxLocation.GetItemText(2) <=returns 2

'Should return "Item3"
cbxLocation.GetItemText(3) <=returns 3

GetItemText seems to be returning the INDEX of the requested item rather than the item TEXT. What in the world would cause such a thing?

Thanks a lot!

--

Don
Nov 20 '05 #4

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

Similar topics

0
by: Jax | last post by:
I am using a class that inherits from the DataGridTextBoxColumn. It adds a combo box into the column where it displays a selection of choices. The problem I have is that when this comboBox loses...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
0
by: tupolev | last post by:
Hi, I already post this item but now I know whats wrong: I want to allow the user to edit the items in a combobox. The problem is that the textchange event works just one time (for the first...
0
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
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,...
1
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
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...
1
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
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
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
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 ...
0
muto222
php
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.