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
Rich
NA
84
61.3k
Display Member Path
Oct 19 2011 7:20 PM
I am trying to populate a wpf ComboBox with my foreach block. When I run the program I can see that that the combobox has made space for the query/items but it is blank. I have verified that my linq query does in fact return items via a message box. Not sure what to do at this point as my code returns no errors either. Thanks in advance for your time and assistance.
var AwayQuery = from allTeams in ComboBoxEnt.AllTeams
where (allTeams.Sport == "Football") && (allTeams.Lvl == "Pro")
&& (allTeams.League == "NFL")
select new
{
MLB = allTeams.MLB_Teams,
NFL = allTeams.NFL_Teams
};
if (AwayQuery.Count().ToString() == "0")
{
MessageBox.Show("nothing returned");
apAwaySelect.Text = "Select Query";
}
else
{
MessageBox.Show(AwayQuery.Count().ToString());
}
foreach (var teamItem in AwayQuery)
{
if (teamItem.MLB != null)
{
apAwaySelect.Items.Add(teamItem.MLB);
apAwaySelect.DisplayMemberPath = "MLB";
}
else
{
apAwaySelect.Items.Add(teamItem.NFL);
apAwaySelect.DisplayMemberPath = "NFL";
}
}
Reply
Answers (
1
)
ASP.NET Chart control problem
Media Player with WPF