tags:

views:

32

answers:

2

am using C#, VS-2005

am new for listview Control in VS-2005. I know how to Insert Records into Listview by typing on Outer Textbox.

But don't know how to directly insert Records on Empty ListView control as it not Focus It's Self.

If any other way or is it possible to insert data directly to ListView Control then Please provide me some code or guide me please.

A: 

If you refer to WinForms, see the System.Windows.Forms.ListViewItem Class, it Represents an item in a ListView control.

ListViewItem class defines the appearance, behavior, and data associated with an item that is displayed in the ListView control. ListViewItem objects can be displayed in the ListView control in one of four different views.

From the example on the same page (see the full example using the ref above):

ListView listView1 = new ListView();
...
ListViewItem item1 = new ListViewItem("item1",0);
...
listView1.Items.AddRange(new ListViewItem[]{item1,item2,item3});
gimel
thx sir, but i want to allow user to insert data directly using listview is it possible?
mahesh
Just insert TextBox content (e.g on click) into a new ListViewItem, then Add that to the ListView.
gimel
how? can u explain me in details or give some exampleand thx sir, for ur feedback
mahesh
Sorry, for detail see complete examples on Winforms sites. Also, search SO for relevant questions, e.g. http://stackoverflow.com/questions/2888659/listview-control-and-details
gimel
A: 

It sounds like you want a grid control rather than a Listview control. In my experience, Listview controls are primarily read-only and grids are editable. Have you considered using a grid?

BlueMonkMN