Re: Forcing a textbox style

Tech-Archive recommends: Fix windows errors by optimizing your registry



> I tried Call SendMessage(hWnd, EM_UNDO, 0, ByVal 0&) but this did not
> work.

If you are using "hWnd" alone, then it refers to the Form, use Text1.hWnd
instead. Also, EM_UNDO doesn't undo the last style change. It is equivalent
to pressing Ctrl+z only.

In addition to what Ken suggested, you could turn off all the 3 styles off
before selecting the new one like this:

' Remove the 3 styles first, if you don't know what it was set to before
style = style And Not ES_UPPERCASE
style = style And Not ES_LOWERCASE
style = style And Not ES_NUMBER

' Set the desired style
style = style Or ES_UPPERCASE


"Guy Cohen" <control@xxxxxxxxxxxxxx> wrote in message
news:O2zb1CquFHA.2008@xxxxxxxxxxxxxxxxxxxxxxx
> Hi all,
>
> I use ES_NUMBER/ES_UPPERCASE/ES_LOWERCASE to force the textbox style.
> Can it be un-done ?
> I tried Call SendMessage(hWnd, EM_UNDO, 0, ByVal 0&) but this did not
> work.
>
> In general I have a combo with two options "Numbers only" and "Upper case"
>
> When it is set to the first value - the textbox is set to numbers only.
> When I set it to the second (meaning - second time I use em_something) it
> is not set to upper case and stays as "Numbers only"
> I tried to use EM_UNDO before setting it to the desired case but could
> not.
>
> Please show the correct way :)
>
> TIA
> Guy
>
>


.