Re: How to insert a '*' in certain controls when Enter is pressed.



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
.



Relevant Pages

  • Re: How to insert a * in certain controls when Enter is pressed.
    ... blah blah1 ... in certain controls when the ENTER key is pressed. ... question have the NewLine property set to YES. ... silly code in the Form_KeyDown event but I think it is the wrong place to go ...
    (microsoft.public.access.formscoding)
  • Re: Remove special formatting characters from textbox contents
    ... What I'd do is cut 'n paste specific character from the Word document into your TextBox ... controls to isolate *exactly* what's causing the problem. ... Controls AfterUpdate event. ...
    (microsoft.public.word.vba.general)
  • Re: RichTextBox Horizontal Scroll
    ... I've already sized the extent of this font ... and have calculated the effective height and width of each character. ... I am scrolling the RichTextBox in synch with some other controls using ... there are some annoying problems with these scroll bar ...
    (microsoft.public.vb.controls)
  • Re: Regular Expression Help
    ... I then allow for validation routines for the given controls. ... > Let me know if you know what the regular expression would be to limit X ... >>> character it should fail. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: edit control from scratch
    ... For the caret position you need Uniscribe, ... recognitions, like the system controls. ... on top of the same character). ... Japanese, Thai, this is not trivial) ...
    (microsoft.public.vc.mfc)