Re: How to insert a '*' in certain controls when Enter is pressed.
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Sat, 5 Jan 2008 13:42:25 +0900
Use SelStart to determine where the cursor is.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"ThomasAJ" <ThomasAJ@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:934DF817-8DEF-4451-B546-99396E3052B4@xxxxxxxxxxxxxxxx
There could be many other NEW LINES either before or after the location of
where the NEW new line is called for. In other words the '*' must be inserted
AFTER where the NEW new line is created.
The end result is to look like:
* blah blah1
* blah blah2
* blah blah3
* blah blah4
--
Regards
Tom
"Minton M" wrote:
On Jan 4, 7:41 pm, ThomasAJ <Thoma...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
> An important user wants to have a '*' inserted at the beginning of a > NEW LINE
> in certain controls when the ENTER key is pressed.
>
> OK so in the Form_KeyDown event I can determine if the enter key has > been
> pressed, and I also know the name of the ActiveControl. The controls in
> question have the NewLine property set to YES.
>
> So how to insert a '*' at the beginning of the new line. I have tried > some
> silly code in the Form_KeyDown event but I think it is the wrong place > to go
> changing control text.
>
> Also bear in mind that the ENTER key may have been pressed in the > middle of
> existing text and not just at the end.
>
> --
> Regards
> Tom
In the control's keypress event, use Replace to search for the newline
character and replace with a * followed by a new line. Don't forget to
use the Text property of the Textbox rather than the value property.
-- James
.
- Follow-Ups:
- References:
- Prev by Date: Re: How to insert a '*' in certain controls when Enter is pressed.
- Next by Date: Re: How to insert a '*' in certain controls when Enter is pressed.
- Previous by thread: Re: How to insert a '*' in certain controls when Enter is pressed.
- Next by thread: Re: How to insert a '*' in certain controls when Enter is pressed.
- Index(es):
Relevant Pages
|