TheCodeNovice
TheCodeNovice

Reputation: 692

Listview items are added as columns instead of rows in C# how do I fix?

I am having problems with a subborn listview object. I have set it up exactly the same way as one that is functioning properly. The problem is when I add items in with a for each statements they are added as rows instead of columns. Hopefully this is simple.

My constructor code

String userstring;

        this.Users.Columns.Add("User");

        foreach (User user in UserListing.userListing)
        {
            userstring = "";
            userstring += user.getUsername() + " "; 
            userstring += " Has Admin Rights:" + user.getRights().ToString() + " "; 
            userstring += " Has Write Access:" + user.getRights().ToString();
            this.Users.Items.Add(new ListViewItem(userstring));
        }
        this.Show();

Upvotes: 0

Views: 1625

Answers (2)

MikeRyz
MikeRyz

Reputation: 299

Well, I just want to add that I was using the Properties in the Visual Studio and changed View to List. That was solution to my problem.

Click here to See the Picture

Upvotes: 0

Alberto Avanzi
Alberto Avanzi

Reputation: 61

I had the same problem, and I fixed it by changing from

myListView.View = View.LargeIcon;

to

myListView.View = View.Details;

Should fix your problem as well.

Upvotes: 2

Related Questions