It would be helpful in my project if people could edit the names of the people in the listbox.
I have a 16 column listbox, but I want the user to be able to edit the first (0) column, where the name is, if they click on only that cell once (I have a different action set for double clicking in a cell already), inline in the cell itself.
Here’s the code i’m using now, and it sorta works, except it doesn’t seem to move to a different name if I click it; it “sticks” on the first name if I click anywhere else:
[code] if me.ListIndex>0 then goto noed
if me.listindex=-1 then goto noed
If this code is in CellClick or MouseDown, it is happening before ListIndex changes, so you will always edit the previously selected row.
Also, you may have a misconception about EditCell. It does not wait for the edit to complete, it sets up the cell for editing and returns immediately. ccname(x) will always have the original value, before the edit takes place. If that’s what you intend, then disregard my comment.
Then how do I allow a user to click once on a cell (the first one in the column, and there are 20 columns) and edit the name inline, and save the result to a corresponding value, in this case ccname(x), which is the stored names in an array with indexes of 1-20?
Any reason you can’t set the column to editable and leave it that way? When the user clicks, it will go into edit mode automatically. You can save the value in CellLostFocus.
That matches your code, but not your description of the problem, or the fact that ccname is an array.
[quote=135218:@Derek DiBenedetto]I have a 16 column listbox, but I want the user to be able to edit the first (0) column, where the name is, if they click on only that cell once (I have a different action set for double clicking in a cell already), inline in the cell itself.
Here’s the code i’m using now, and it sorta works, except it doesn’t seem to move to a different name if I click it; it “sticks” on the first name if I click anywhere else:[/quote]