Re: How to insert a '*' in certain controls when Enter is pressed.
- From: ThomasAJ <ThomasAJ@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 4 Jan 2008 21:45:00 -0800
Thanks for that.
Any chance of more help.
I am using very clunky code that is not working.
eg the new line is being created at the start of the text, also when the
enter key is pressed at the end of some text the code falls over.
My code is:
MiscDetails.Text = Mid$(MiscDetails, 1, MiscDetails.SelStart) & "*" &
Mid$(MiscDetails, MiscDetails.SelStart + 1, Len(MiscDetails) -
MiscDetails.SelStart + 1)
Apart from the fact it is not working I bet there is a more specific
function I can use as well.
--
Regards
Tom
"Allen Browne" wrote:
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:
- Re: How to insert a '*' in certain controls when Enter is pressed.
- From: Allen Browne
- Re: How to insert a '*' in certain controls when Enter is pressed.
- References:
- Re: How to insert a '*' in certain controls when Enter is pressed.
- From: Minton M
- Re: How to insert a '*' in certain controls when Enter is pressed.
- From: ThomasAJ
- Re: How to insert a '*' in certain controls when Enter is pressed.
- From: Allen Browne
- Re: How to insert a '*' in certain controls when Enter is pressed.
- 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
|