Mark
Mark

Reputation: 419

ListView doesn't show up at all

Good day all.
I have an issue with using the ListView control in C#:
I can create an Object of it and at least from what the debugger says (nothing) I can also add items and columns and all. However:
I cannot see the ListView at all.
Below the code with which I want to draw it onto an otherwise emtpy Form:

private ListView auftraegeView;

And then inside the constructor, after InitializeComponent:

auftraegeView = new ListView();
auftraegeView.View = View.Details;
auftraegeView.Width = this.Width - 12;
auftraegeView.Height = this.Height - 20;
auftraegeView.Left = 6;
auftraegeView.Top = 14;

I tried .Show() and .Refresh() methods, but to no avail.

Upvotes: 0

Views: 82

Answers (2)

abrfra
abrfra

Reputation: 654

Have tyou tried BringToFront and checked that the prorperties Visible = true? i Now is trivial but..

Upvotes: 0

Ehsan
Ehsan

Reputation: 32661

The problem is that you are not adding your control to your form. You have created the object but now you need to show it on the form. For that you have to add it to the list of controls that need to be shown on the forms.

Some thing like

yourFormName.Controls.Add(auftraegeView );

Upvotes: 3

Related Questions