473,320 Members | 2,111 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,320 software developers and data experts.

I would like to get the item index of a string located in a comboBox.

I write this code :

MyCombo.SelectedIndex = MyCombo.Items.IndexOf ("MyString")

this line return -1 as the index value ( it means MyString is not found)

"MyString" exists in the items list. MyCombo is filled with the following code :

MyCombo.DataSource = MyDataSet.tables
MyCombo.DisplayMember = "...."
MyCombo.ValueMember = "...."

thanks
Jan 5 '10 #1
1 2126
weaknessforcats
9,208 Expert Mod 8TB
"MyString" is a char string. Do you need a wide-char string instead?
Jan 5 '10 #2

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

Similar topics

7
by: Yavuz Bogazci | last post by:
Hi, i have a question: how can i add items to my comboboxes with more informations. For Example i want to show the names of my customers an behind the names i want to store id's or phonenumbers...
11
by: Bill nguyen | last post by:
Table A has 2 columns: recID int recName String I need to load all recName into combobox B using B.Items.Add(recName). This is no problem. However, I would like to be able to match ComboxBox...
4
by: Joe Schmoe | last post by:
All I want to to be able to take a two-column DataReader (One column with the Item ID number, the other with Item Description text) and load it into a Windows Forms ComboBox (Set to DropDownList...
6
by: kmercer46 | last post by:
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??
5
by: Jeremy McPeak | last post by:
I am writing a collection. I downloaded the Rotor kit and started looking at how the classes in System.Xml are written and am using them as a guide. For my collection, I thought I'd use XmlNodeList...
1
by: HKSHK | last post by:
Hi guys, I have a problem with the combo box I'm writing on. What I want is custom items, which are fine so far, but when I select one the combo box shows the project name...
0
by: alexia.bee | last post by:
Hi All, I am trying to get the index of an item that the mouse is pointing/ hovering at. Meaning, when user click the Combobox, droplist is show. When you hover the mouse on item, it highlight...
7
by: Brad Pears | last post by:
I have something strange going on - pretty sure it used to work before - and now it does not... Why does the following code not clear a combo box? Me.cboLocation.Text = String.Empty OR ...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.