shadow9449
Registered User.
- Local time
- Today, 02:57
- Joined
- Mar 5, 2004
- Messages
- 1,037
I have a list box with strings of data. There is a button underneath the list box that allows the user to select a string from the list box, click the button and the text gets moved into a memo box to the left of the list box. (Drag and drop would be really great here to make this work like all other programs but that's not going to happen in Access!)
The idea is to build a few paragraphs in the memo box based on different sentences in the list box.
The way I've implemented this is with a simple line of code like:
me.MyMemoBox = me.MyMemoBox & " " & me.ListBox
This works great but now I have a user saying that she wants to be able to put the cursor anywhere in middle of the text in the memobox, select a string from the list box and have the text get inserted at the point of the cursor rather than always going to the end of the existing text.
There are two ways I've thought of:
- Sendkeys can do this very easily but I do everything I can to not use Sendkeys as I know it's not reliable and reportedly doesn't work on Vista.
- If I could somehow find out where the cursor is (i.e. it's position from the beginning of the text) I could change the code to:
me.MyMemoBox = left(me.MyMemoBox, PositionOfCursor) & " " & me.ListBox & " " & right(me.MyMemoBox, PositionOfCursor)
The problem is that I don't know if a function exists to find the position of a cursor amid a string of text.
I would appreciate if someone could help me by either suggesting a function that would return the position of the cursor or suggesting another means to accomplish this.
Thank you
SHADOW
The idea is to build a few paragraphs in the memo box based on different sentences in the list box.
The way I've implemented this is with a simple line of code like:
me.MyMemoBox = me.MyMemoBox & " " & me.ListBox
This works great but now I have a user saying that she wants to be able to put the cursor anywhere in middle of the text in the memobox, select a string from the list box and have the text get inserted at the point of the cursor rather than always going to the end of the existing text.
There are two ways I've thought of:
- Sendkeys can do this very easily but I do everything I can to not use Sendkeys as I know it's not reliable and reportedly doesn't work on Vista.
- If I could somehow find out where the cursor is (i.e. it's position from the beginning of the text) I could change the code to:
me.MyMemoBox = left(me.MyMemoBox, PositionOfCursor) & " " & me.ListBox & " " & right(me.MyMemoBox, PositionOfCursor)
The problem is that I don't know if a function exists to find the position of a cursor amid a string of text.
I would appreciate if someone could help me by either suggesting a function that would return the position of the cursor or suggesting another means to accomplish this.
Thank you
SHADOW