question

abcabc-6368 avatar image
0 Votes"
abcabc-6368 asked DavidLowndes-6766 commented

How to allow the user to enter or type only 1 to 2147483647 in the MFC CEdit control without using DDV_MinMaxLong?

Hi,

How to allow the user to enter or type only 1 to 2147483647 in the MFC CEdit control without using DDV_MinMaxLong or DDV_MinMaxInt?

if I use DDV_MinMaxInt or DDV_MinMaxLong , the user is allowed to enter or type more than 2147483647 and If User enter more than 2147483647 getting the prompt message "Enter an integer between 1 and 2147483647. My requirement is user should not get prompt message and the user should be allowed to enter only 1 to 2147483647.

Is it possible to achieve my requirement using MFC CEdit Control and how to achieve this?

c++
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Beware that your method may be more inconvenient/highly irritating for the user who wants to edit the text (number) as incidental editing may give rise to falling foul of what you do to prevent the entry!
You could handle ON_EN_UPDATE, check the entry, and do what you want there - such as setting the text to the prior value.

1 Vote 1 ·

0 Answers