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 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
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
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 > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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 :...
|
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...
|
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...
|
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...
|
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<>,...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |