Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have a Dot.Net 3.5 winforms control with a TextBox control.
This TextBox accepts uppercase letters and numbers.
If a value is entered, the currently maximum value should be displayed as a watermark behind the cursor.

Example: Input "A1C" and the maximum value is "A1CDB1", then "A1C" should be displayed normally, then the cursor and then "DB1" as watermark.

I know there are some examples that show a watermark when the TextBox is empty, there are also many autocomplete examples, but that's not what I need.

If the user enters "A1CDB1" or another existing value, the color of the input text changes to red.

What I have tried:

I tried to draw the watermark text behind the cursor position on OnPaint, but that was not successful.

Does anyone have a working idea/solution?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900