>I have an editbox on a form. The editbox is tied to a Memo field. The editbox contains a list of names. I made a command button called Delete that is going to be used to remove a selected name from the editbox.
>
>What's the best way to do this? How can I identify the line that the user wants to remove from the editbox and then remove it? Use a line number? SelText? Can I set it up so that the user clicks on a line and the whole line gets selected automatically? And then when the user presses Delete button the line disappears and all the other names move up one position.
>
>Any help is very much appreciated.
>
>My Add button to add a name to the editbox works great. My Delete button does not.
Provided the values of .selstart and .sellength in your editbox are set properly, you can pretty much do this:
with oTheEditBox
.value=stuff(.value, .selstart, .sellength, "")
endwith
You'd be better off with a listbox, though - it's selectable using a single click. You could use an array (property) to populate it from the memo using alines(), and later save the values back into the memo concatenating array values delimited by chr(13). The downside would be that you'd have to have a textbox to add values.