Reputation: 1367
I am trying to show listbox in but it didnt works, this code in datagridview_mouseClick event: With debugger it passes all lines below, but show nothing
ListBox lb = new ListBox();
lb.Size = new Size(200, 300);
lb.Location = new Point(500, 500);
lb.Items.Add("a");
lb.Items.Add("b");
lb.BringToFront();
listBox1.Show();
Any idea where is the problem?
EDIT: My datagridview is in tableLayout and docked - could it be problem?
I am using winforms and c#
Upvotes: 1
Views: 1937
Reputation:
The ListBox has to be contained in something (like your form):
this.Controls.Add(lb);
The appropriate place to add it depends on where and how you want it to appear.
Upvotes: 4