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
anupama b
NA
7
3.5k
Comparing the Search String with the Array in WPF
Feb 6 2012 9:14 AM
Hi,
This is the first time i am using WPF with LINQ
I am writing the below code to load the listbox
string usageIndicator = AppEnvironment.ToUpper() == "PROD" ? "P" : "T";
using (X12837DataContext dc = new X12837DataContext(_ediConnectionstring))
{
IList<tbl837SubmissionGroupData> submissionGroups = dc.tbl837SubmissionGroupDatas.Where(s => s.UsageIndicator == usageIndicator &&
(s.SelectClaimsByDate == "Y" || s.SelectClaimsNotSent == "Y")).OrderBy(g => g.SubmissionGroupName).ToList();
lstBoxSubmissionGroup.ItemsSource = submissionGroups;
lstBoxSubmissionGroup.DisplayMemberPath = "SubmissionGroupName";
ResponseText = string.Format("{0} submission groups listed.\n", submissionGroups.Count);
}
where tbl837SubmissionGroupData is a class containing all the attributes ,
submissionGroups andsubmissionGroupName are the attributes.
now the data is like submissiongroups have [0],[1],[2],[3]
which internall contains variables...
[0] ==> id, groupname,groupid
so i want to check all the list [0][1][2][3] data to find a string suppose "mat"which is a unique value in the entire list and get its index.
for example i found mat in [2] then i want to return 2 as index
how to do that. i wrote the following code after the above code but no use i am getting nowher could u please suggest a better approach or help me with any link
IEnumerable items = lstBoxSubmissionGroup.Items;
foreach (object obj in items)
{
string val = obj as string;
if ((!string.IsNullOrEmpty(val)) && val.Contains(searchString))
{
int id = lstBoxSubmissionGroup.Items.IndexOf(obj);
}
}
Reply
Answers (
0
)
Windows 8 style Scrolling in WPF
Assign mouse clicks to buttons, if mouse 1 or 2 is pressed then a button is pressed