views:

649

answers:

2

I have 2 questions concerning C#.

1) I have a dropdown menu with several items in them. They are clickable, but when I click one, the older clicked one stays selected. Click another and the 2 original ones stay selected, and so on. I don't want this. What I want is that when I click one of the dropdownitems, that one is that selected one and the others are not.

2) I have a listview items on a winform. I loaded some string elements into it from a file. Now what I want to do is to be able to edit those strings and even add strings, just by clicking on the rows in which the data goes.

I've checked google and MSDN for these problems, but nothing helps, so I turn here.

A: 

2) The ListView does not support that type of action. You can roll your own (pain in the @$$), or perhaps a DataGrid would be better suited to your purpose.

EDIT:

This link may help
This one too

Ed Swangren
Myeah, it's a school assignment and the task description says: "implement a Listview which you will fill up with addresses, located in a textfile. The Listview must have checkboxes and must be editable".Implementing the checkboxes was no problem, it's the editable where I'm stuck.
Vordreller
A: 

For #1 I'm a little confused. If the DropDownStyle isn't set to simple something strange is occuring. It's not much but maybe you could try recreating the control.

For #2 the easiest solution I can think of is to set a TextBox to be equal to the selected text value from your listview. After that write a little function to update the selected index of the listview with the edited text from the listview.

Please comment if you have any more information about #1.

what is DropDownStyle? I'm using Visual Studio 2008 and it's not showing such a property...To be more specific, this dropdownlist comes from a ToolStripMenuItem which is part of a winform MenuStrip
Vordreller
Ah I see where we disconnected. I interpreted DropDown to mean a DropDownList not a menu item.If in your MenuToolStrip you have a ToolStripComboBox it will have the DropDownStyle like a DropDownList will have. I'd start with that property being set to DropDown.