Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
5
Answers
error - add list items to the static class variable C#
Mani Kandan
8y
232
1
Reply
I want to get list listview items in the static class. Because I want to pass this class variable to another class. So I have tried...
public
static
class
FileMngUserID
{
public
static
List<
int
> UserId;
public
static
List<
string
> ImgName;
}
foreach (DocumentsUser item
in
listView1.SelectedItems)
{
FileMngUserID.UserId.Add(Convert.ToInt32(item.UserId));
FileMngUserID.ImgName.Add(item.Parent_File_Name);
}
but here
FileMngUserID.UserId.Add(Convert.ToInt32(item.UserId));
occurring error '
Object reference not set to an instance of an object.
'
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
how to do databinding between more XML files for TreeView
what outer loop and inner loop represent in bubble sort