Click here to Skip to main content
15,898,599 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralStupid Compiler Tricks Pin
Cam13-Dec-01 11:51
Cam13-Dec-01 11:51 
GeneralRe: Stupid Compiler Tricks Pin
13-Dec-01 12:33
suss13-Dec-01 12:33 
GeneralRe: Stupid Compiler Tricks Pin
Cam13-Dec-01 13:01
Cam13-Dec-01 13:01 
GeneralRe: Stupid Compiler Tricks Pin
Michael Dunn13-Dec-01 13:15
sitebuilderMichael Dunn13-Dec-01 13:15 
GeneralRe: Stupid Compiler Tricks Pin
Cam13-Dec-01 14:43
Cam13-Dec-01 14:43 
GeneralEdit Box Variables Pin
13-Dec-01 10:38
suss13-Dec-01 10:38 
GeneralRe: Edit Box Variables Pin
Christian Graus13-Dec-01 11:05
protectorChristian Graus13-Dec-01 11:05 
GeneralRe: Edit Box Variables Pin
Cam13-Dec-01 12:12
Cam13-Dec-01 12:12 
If you didn't follow what the last guy said, I'll try to make it a little simpler. I'm a newbie myself, but I could write the program you're writing Smile | :) . First off, about atoi atof, these are C/C++ library functions. Basically that means they are prewritten functions that you can call from your program if you so please. They, respectively, convert an ASCII char(acter) to int(eger), or an ASCII char(acter) to a float(ing point number). But screw those for now Big Grin | :-D

When you wrote your program, odds are you made a dialog in the resource editor, then you threw some edit boxes onto it. Next you ran ClassWizard to assign member variables to them. But the problem is that you assigned the wrong type of variables to them. So, to fix all this, open Visual Studio, and hit Ctrl+W. Click the "member variables" tab. Now there should be a list. On the left you will see them names of your edit boxes. Select one of your edit boxes, and click "Delete Variable". Then click "Add Variable" choose the name you would like for the variable (would be best to use the same name you used before so you don't have to recode), make sure "Value" is selected in the next box down, and then make sure "int" is selected in the bottom box. Now press 'Ok'. Repeat this process for all three of your edit boxes, and you should be all set.

----

I need to append something to this. When I first started programming in VC++ I made a program like that, and annoyed the hell out of myself because all of the code seemed right, and I got no errors, but it would never display! In case this is happening to you, here's the explanation. The data typed in to an edit box isn't actually stored directly into the member variable we supply for that purpose. We have to call the UpdateData() function to get what's in the window and put it into the variable. UpdateData takes one parameter, either TRUE or FALSE; UpdateData(TRUE) takes the data that is in the window, and puts it into the variables. UpdateData(FALSE) does the exact opposite, it updates the window. So, when your user clicks the multiply button, we need to do something like this:

void CMyProgDlg::OnMultiply()
{
// TODO: Add your control notification handler code
UpdateData(TRUE); //Puts data in member variables
m_Sum = m_NumOne * m_NumTwo; //multiplies
UpdateData(FALSE); //Puts data to screen
}

Anyway, just hoping to say you a headache. I just spent two minutes or so throwing together a program that doe exactly what you want yours to do. If you find yourself needing more help, download it from this link.

~Cam Desautels (www.BinaryUprising.com), always welcome to help out the new ones
GeneralRe: Edit Box Variables AGAIN Pin
13-Dec-01 12:29
suss13-Dec-01 12:29 
GeneralRe: Edit Box Variables AGAIN Pin
Cam13-Dec-01 12:37
Cam13-Dec-01 12:37 
GeneralRe: Edit Box Variables AGAIN Pin
13-Dec-01 13:38
suss13-Dec-01 13:38 
GeneralRe: Edit Box Variables AGAIN Pin
Cam13-Dec-01 14:40
Cam13-Dec-01 14:40 
GeneralRe: Edit Box Variables AGAIN Pin
Christian Graus13-Dec-01 16:01
protectorChristian Graus13-Dec-01 16:01 
GeneralRe: Edit Box Variables AGAIN Pin
13-Dec-01 16:07
suss13-Dec-01 16:07 
GeneralRe: Edit Box Variables AGAIN Pin
Christian Graus13-Dec-01 16:02
protectorChristian Graus13-Dec-01 16:02 
GeneralRe: Edit Box Variables AGAIN Pin
Cam13-Dec-01 16:22
Cam13-Dec-01 16:22 
GeneralRe: Edit Box Variables Pin
Rick York13-Dec-01 14:28
mveRick York13-Dec-01 14:28 
GeneralRe: Edit Box Variables Pin
Cam13-Dec-01 15:09
Cam13-Dec-01 15:09 
GeneralRe: Edit Box Variables Pin
13-Dec-01 15:15
suss13-Dec-01 15:15 
GeneralRe: Edit Box Variables Pin
Cam13-Dec-01 15:53
Cam13-Dec-01 15:53 
GeneralRe: Edit Box Variables Pin
13-Dec-01 16:01
suss13-Dec-01 16:01 
GeneralRe: Edit Box Variables- typos Pin
13-Dec-01 16:03
suss13-Dec-01 16:03 
GeneralRe: Edit Box Variables Pin
13-Dec-01 16:05
suss13-Dec-01 16:05 
GeneralRe: Edit Box Variables Pin
Cam13-Dec-01 18:35
Cam13-Dec-01 18:35 
Generalstupid toolbar question Pin
jafrazee13-Dec-01 8:46
jafrazee13-Dec-01 8:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.