TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
David
NA
6
0
Why doesnt this work?
Apr 27 2016 7:33 PM
foreach
(DataRow dataRow
in
dt.Rows)
{
if
(dataRow[
"Column1"
].ToString().Contains([
"ExampleString"
])
{
listBox1.Items.Add(dataRow[
"Column1"
] +
" "
+ dataRow[
"Column2"
] +
" "
+ dataRow[
"Column3"
] +
" "
+ dataRow[
"Column4"
]);
}
}
//the above code works perfectly and returns only the rows containing the "ExampleString"
// if i try to use a SelectedText value from a combobox as a string to replace the "ExampleString", (as shown below),the listbox populates with ALL of the rows, not just the ones with the "ExampleString".
string
strFromCombobox = comboBox1.SelectedText;
foreach
(DataRow dataRow
in
dt.Rows)
{
if
(dataRow[
"Column1"
].ToString().Contains(strFromCombobox)
{
listBox1.Items.Add(dataRow[
"Column1"
] +
" "
+ dataRow[
"Column2"
] +
" "
+ dataRow[
"Column3"
] +
" "
+ dataRow[
"Column4"
]);
}
}
Reply
Answers (
5
)
keyword intergratedsecurity not supported
Class FireBird Help me.