Click to See Complete Forum and Search --> : Edit box


acce55
October 25th, 2009, 01:25 PM
how do i get content into a edit box
I have a button and when i press it, i want to calulate 5 + 5, and it 10 goes into the edit box.


in MVC++, I would use UPDATEDATE(FALSE), UPDATEDATA();


.....
if(HIWORD(wParam) == BN_CLICKED) <---under that code.....is where the code i need help with


thank you

acce55
October 25th, 2009, 01:54 PM
Ok

i got this code so far

case IDB_BUTTON:{
if(HIWORD(wParam) == BN_CLICKED){
SetWindowText(hEdit, "MyTExt");
}
}
break;

when i click the button, it sets the edit box to MYTEXT...but how do i calculate something ..
say i have to edit boxes. i put 2 in the first edit box, and i add the value 10 to it in the code..and it comes out to the second edit box as 12..

thank you

Orum
October 26th, 2009, 07:33 AM
when i click the button, it sets the edit box to MYTEXT...but how do i calculate something ..
say i have to edit boxes. i put 2 in the first edit box, and i add the value 10 to it in the code..and it comes out to the second edit box as 12..

thank you
This isn't really WinAPI specific (except the edit boxes).

To get information out of an edit control, look at GetWindowText() on MSDN. If it's in a dialog, you can also look at GetDlgItemText()/GetDlgItemInt().

If you need to perform operations on the variables (like adding, etc.), do that in your program with variables.

Snoopy07
November 4th, 2009, 01:43 AM
Use n= atof (MyText);

to convert MyText into an integer

n=n+10;

then
sprintf (MyText, "%.2f", n);

or whatever format you like
then
SetWindowText(hEdit, "MyTExt");
hope this helps