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
roger rickert
NA
21
1.1k
C# winforms databinding question
Jan 19 2021 3:40 PM
Hello, I have a databinding question. I have a List of objects that contain multiple fields. Is there a way to bind a control (ex. label) to a specific field in one of the objects? here's some pseudo code to help illustrate:
Class:
public class StoreFields
{
public string apple;
public string orange;
public string grape;
}
I create a list of those objects:
public static List
Store = new List
(3)
{
new StoreFields(),
new StoreFields(),
new StoreFields()
}
I then have some labels that I'd like to databind with fields from the objects in that list.
for example:
databind Label1 to Store[1].Apple
I tried:
Lable1.DataBindings.Add("Text", Store[1].Apple, "Text");
The following exeption was thrown:
{"Cannot bind to the property or column Value on the DataSource.\r\nParameter name: dataMember"}
is something like this possible?
Reply
Answers (
1
)
i want to learn about c# programming
Problem deploing C# winforms application