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
ankit r
NA
3
2.1k
Object reference not set to an instance of an object.
Apr 13 2012 12:55 PM
Hello everyone and thanks in advance.
I am getting an error " Object reference not set to an instance of an object." when I try to add an item to a integer list of class "FreeHoursClass" which has a public list "FreeHoursList".
This is my code.
public class FreeHoursClass
{
public List<int> FreeHoursList = new List<int>();
}
private void button1_Click(object sender, EventArgs e)
{
FreeHoursClass[] ff = new FreeHoursClass[30];
ff[5].FreeHoursList.Add(9);
MessageBox.Show(ff[5].FreeHoursList[0].ToString());
}
Reply
Answers (
3
)
Save a List of objects in another object.
Dataset - assingnment of value to cell without effect