473,399 Members | 3,302 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,399 software developers and data experts.

FindStringExtract() won't work if ComboBox populated by setting DataSource

I notice in the ComboBox, when set its DataSource, its .Items will be empty
collection. And .FindStringExtract() will not find anything. Seems this is
not documented.
Ryan
Jun 5 '06 #1
3 3363
Ryan,

FindStringExact (and FindString) will only work when you populate the
list through the Items property. It doesn't work for databinding.

However, you can create a general search algorithm that takes the list
source, as well as the display item, and evalulates each item in the list,
looking for the string.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ryan Liu" <ad********@online.sh.cn> wrote in message
news:u2**************@TK2MSFTNGP04.phx.gbl...
I notice in the ComboBox, when set its DataSource, its .Items will be empty
collection. And .FindStringExtract() will not find anything. Seems this is
not documented.
Ryan

Jun 5 '06 #2
Thanks, Nicholas !

Now I write so it will fist go though its DataSource(cast to IList), if not
found, then I try FindStringExact(). I was trying to write a generic code,
now I hope this is also safe enough.

Regards,
Ryan
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> дÈëÓʼþ
news:%2****************@TK2MSFTNGP02.phx.gbl...
Ryan,

FindStringExact (and FindString) will only work when you populate the
list through the Items property. It doesn't work for databinding.

However, you can create a general search algorithm that takes the list
source, as well as the display item, and evalulates each item in the list,
looking for the string.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ryan Liu" <ad********@online.sh.cn> wrote in message
news:u2**************@TK2MSFTNGP04.phx.gbl...
I notice in the ComboBox, when set its DataSource, its .Items will be empty collection. And .FindStringExtract() will not find anything. Seems this is not documented.
Ryan


Jun 5 '06 #3
Ryan,

Well, I would switch on whether or not there is a data source or not,
but yes, using the IList implementation, along with the DataMember and the
DisplayMember properties should be enough.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ryan Liu" <ad********@online.sh.cn> wrote in message
news:ep**************@TK2MSFTNGP04.phx.gbl...
Thanks, Nicholas !

Now I write so it will fist go though its DataSource(cast to IList), if
not
found, then I try FindStringExact(). I was trying to write a generic code,
now I hope this is also safe enough.

Regards,
Ryan
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
дÈëÓʼþ
news:%2****************@TK2MSFTNGP02.phx.gbl...
Ryan,

FindStringExact (and FindString) will only work when you populate the
list through the Items property. It doesn't work for databinding.

However, you can create a general search algorithm that takes the
list
source, as well as the display item, and evalulates each item in the
list,
looking for the string.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ryan Liu" <ad********@online.sh.cn> wrote in message
news:u2**************@TK2MSFTNGP04.phx.gbl...
>I notice in the ComboBox, when set its DataSource, its .Items will be empty > collection. And .FindStringExtract() will not find anything. Seems this is > not documented.
>
>
> Ryan
>
>



Jun 5 '06 #4

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

Similar topics

3
by: Paul Fairless | last post by:
Customers table - contains Columns: CustID, Surname, Forename, TtlID Titles table - contains Columns: TtlID, Title TtlID is a Foreign Key in the Customers table. I have a Form frmCustomers...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
3
by: Flack | last post by:
Hello, I am beginning to write a custom combobox control. Right now it doesn't do anything special. I created a class that extends ComboBox: public class TimeSelector :...
2
by: chris in grimsby | last post by:
I have a combobox of dropdownlist style as one of the controls on a tabbed form. The list is populated by setting the DataSource property to a dataset and then the DisplayMember and ValueMember...
2
by: mollyf | last post by:
Hello everyone-- I've tried many of the things I've found searching the newsgroups in trying to store 2 fields to a combobox and use displaymember and valuemember but nothing is working. Here...
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...
4
by: SHEBERT | last post by:
Here is an example of a SortedList that works as a datasource to the ComboBox and a generic SortedList<that does not works as a datasource to the ComboBox. Why? If I use List and generic List<>,...
1
by: progressdll | last post by:
I'm trying to change the behaviour of setting the DataSource property of combobox. Here is the behaviour I now see. Setting the DataSource property of combobox to an ArrayList will visual...
2
by: samueltilden | last post by:
This problem should be simple. I am using Visual Studio 2003, Version 1.1 I am writing a desktop application in which I am binding a DataTable to the DataSource of a ComboBox. // I have...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
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,...
0
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...

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.