I am using an Edit Box to "modify" numbers on static text. The only problem is that I want the numbers to be between 1 & 20. I am using a member named m_eName with a type of CEdit. I know you can set value if you use type int, but what about CEdit?
I am using an Edit Box to "modify" numbers on static text. The only problem is that I want the numbers to be between 1 & 20. I am using a member named m_eName with a type of CEdit. I know you can set value if you use type int, but what about CEdit?
C++ Is Powerful
I use C++
There fore I am Powerful
I think you'd have to write some simple code to check the range of the number entered and warn the user (or just put the number in range again) if they type a number over 20 or below 0.
/* MSN and E-Mail - head_explodeshotmail.com */
If Bill Gates got a dollar for every time windows crahsed... oh... he does.
I always use MSVC++6.0
Ok, I was just wandering if there was a function or anything. Thx.
C++ Is Powerful
I use C++
There fore I am Powerful
There's no special function for that but you can implement one easy.
What you need to do is trap the EN_UPDATE notification message (is received through the WM_COMMAND) from the edit box. This means that the user changed the contents.
Then get the value with GetDlgItemInt() and check whether the value is valid or not.
Chemanuel
Lo bueno si breve dos veces bueno (Baltasar Gracián 1601-1658)
Ok I must have not understood this quite right. I tried doing it the way that headexplodes suggested (I don't know how to do it your way Chemanual I use MFC). Anyways here is what I tried and didn't work.
CString nValue;
CString nValue2="20"; //Test value
m_edValue.GetWindowText(nValue); //member var for edit
//Check to see if the nValue is <20
if(nValue<=nValue2)
{
......do the necesary updat on static text.....
}
//Popup message that nValue is grater than 20!
else if(nValue>nValue2)
{
MessageBox("Your value of "+nValue+" is grater than "+nValue2+"!","Allert!",MB_OK);
nValue=" ";
}
The problem is that it always (ALWAYS) pops the message box up saying the your value is grater than that of 20. Any suggestions???
C++ Is Powerful
I use C++
There fore I am Powerful