mfc combo box help

i have a problem with mfc, after choosing something in the combo box
the edit box should update and show the text corresponding to the
combo box choice, but what happens is when i choose something from the
combo box nothing happens im new to mfc and so i need a little help
please, heres the code:

void CQuakeLaunchDlg::OnCloseupModtorun()
{
 CString modname;        //combo box variable
 m_strmod = modname;

 if (modname == "ORIGINAL QUAKE")
  m_cline = "qwcl.exe";

 if (modname == "ZQUAKE")
  m_cline = "zq-client-gl.exe";

 if (modname == "TEAM FORTRESS")
  m_cline = "zq-client-gl.exe -game fortress";

UpdateData(FALSE);    
}
0
oktogon (1)
7/13/2003 2:52:47 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
599 Views

Similar Articles

[PageSpeed] 15

Everything looks fine to me, except one thing...

"Oktom Ben" <oktogon@poczta.onet.pl> wrote in message
news:93823e62.0307130120.4dc82f3d@posting.google.com...
> i have a problem with mfc, after choosing something in the combo box
> the edit box should update and show the text corresponding to the
> combo box choice, but what happens is when i choose something from the
> combo box nothing happens im new to mfc and so i need a little help
> please, heres the code:
>
> void CQuakeLaunchDlg::OnCloseupModtorun()
> {
>  CString modname;        //combo box variable
>  m_strmod = modname;

Shouldn't this be
modname = m_strmod??

>
>  if (modname == "ORIGINAL QUAKE")
>   m_cline = "qwcl.exe";
>
>  if (modname == "ZQUAKE")
>   m_cline = "zq-client-gl.exe";
>
>  if (modname == "TEAM FORTRESS")
>   m_cline = "zq-client-gl.exe -game fortress";
>
> UpdateData(FALSE);
> }

--
MiniDisc_2k2


0
MattDelB (30)
7/13/2003 5:42:17 PM
Oktom Ben wrote:

>i have a problem with mfc, after choosing something in the combo box
>the edit box should update and show the text corresponding to the
>combo box choice, but what happens is when i choose something from the
>combo box nothing happens im new to mfc and so i need a little help
>please, heres the code:
>
>void CQuakeLaunchDlg::OnCloseupModtorun()
>{
> CString modname;        //combo box variable
> m_strmod = modname;

This gives m_strmod the value of modname, which is the empty string.

> if (modname == "ORIGINAL QUAKE")
>  m_cline = "qwcl.exe";
>
> if (modname == "ZQUAKE")
>  m_cline = "zq-client-gl.exe";
>
> if (modname == "TEAM FORTRESS")
>  m_cline = "zq-client-gl.exe -game fortress";

As modname is empty, all these comparisons evaluate false.

>UpdateData(FALSE);    
>}

You should use UpdateData only when you want to transfer and validate all
controls participating in DDX/DDV. When you need to do single controls, call
member functions such as GetWindowText and SetWindowText on the control
variables you created for them in ClassWizard. Below are some excerpts from
past messages I've written on this subject:

In a nutshell, here's what I think you need to know about UpdateData:

1. Call UpdateData(TRUE) only when you want to transfer and validate _all_
dialog data participating in DDX/DDV. The direction of the transfer is
from the controls to the value member variables (the "m_vars"), and the
contents of the m_vars should be considered reliable following
UpdateData(TRUE) if and only if UpdateData(TRUE) returned true.

2. Call UpdateData(FALSE) only when you want to transfer data from _all_ the
m_vars to the controls.

3. UpdateData calls your DoDataExchange override to perform the transfer and
validation. Adding code to DoDataExchange is a valuable technique for
performing higher-level validation than is offered by DDV; you can test the
CDataExchange::m_bSaveAndValidate member to determine the direction of the
transfer. DoDataExchange also contains the DDX_Control calls which bind
control variables to dialog controls; this subclasses the dialog controls
and is absolutely essential to the correct operation of these control
variables.

Briefly, here's my approach to dialog data. It's valid until
CDialog::OnInitDialog() is called, which does the initial UpdateData(FALSE),
to transfer the contents of the m_vars to the controls. Afterwards, it's
invalid, unless UpdateData(TRUE) has been called and returned TRUE, or
DoModal() has returned IDOK (or whatever code signifies success), which
implies UpdateData succeeded. Otherwise, you shouldn't assume a given m_var
is valid, unless you've just set it yourself.

-- 
Doug Harrison
Microsoft MVP - Visual C++
0
dsh (2498)
7/13/2003 5:49:32 PM
Reply:

Similar Artilces:

How Create Pop-Up Msg when item selected in List Box?
How do I have a message box or pop-up message occur when a user selects a specific valid entry from a "list" for a cell? Details: For a cell, I did a Data, Validation, List. I created a list of 4 valid entries (box, kite, crayon, fish) the user may select. When the user selects entry crayon, I want a message to pop up, example " Be sure to specify the colors later." Thanks, rick onlinemanZZ@exZcite.com (<= remove "Z"s for valid email.) Rich You could use a worksheet change event. The code below will present a message box on each entry. Test it ...

IMC Auto Stop (Urgent Help)
Dear , I am using a Exchange 5.5 Sp 4 on Window 2000 SP 4 And My Exchange IMC Auto Stop. I found below Event Log on My Server Any one know what is it Mean and how to Fix it . Thanks A lot Sean Source : MSExchangeIMC Category : Internal Processing Event ID : 4037 Description The application, USA\MSEXCIMC.exe, generated an application error The error occurred on 11/14/2003 @ 17:30:56.896 The exception generated was c0000005 at address 00443AE1 (CMessageInstance::RetryAllRecipients) Source : DrWartson Category : None Event ID : 4097 Description The application, USA\MSEXCIMC.exe, generated ...

Can I use named range in data range box when creating pie chart?
I have 75 pie charts to create today. Is there a way to use named ranges in the data range box to speed this up? Yes. Just type in the name. -- George Nicholson Remove 'Junk' from return address. "BJackson" <BJackson@discussions.microsoft.com> wrote in message news:0DE9A0AD-C3BA-4242-B3BA-3CC3F0D87894@microsoft.com... >I have 75 pie charts to create today. Is there a way to use named ranges >in > the data range box to speed this up? Thank you! I was making it too difficult, thinking I needed to include the Sheet name along with the name range. ...

Help Desk Read Only Administration
How can I give our help desk the ability to: 1. View mail queue 2. View mailbox sizes, limits 3. Not give them the ability to midify storage limits - this is given with a simple admin console install - not good! I assigned the view only delegation but have found its not granular enough. Per a tech net article, it seems I may have to manually assign all these rights? "In some cases, the Exchange Administration Delegation Wizard does not provide enough granularity for assigning security permissions. Therefore, for individual objects within Exchange, you can modify the settings on th...

Combo Box #25
Hi, I have a combobox that is linked to Range = A1:A11, using the RowSource = A1:A11 in the properties window. The problem is that I launch the combobox in a tab, and the range A1:A11 is in another tab. Is there anyway to specify which tab the range A1:A11 is in. The combobox launches from a chart and the range A1:A11 are the charts you can choose. Thanks Just type in the name: 'Sheet 99'!a1:a11 Jeff wrote: > > Hi, > > I have a combobox that is linked to Range = A1:A11, using the RowSource = > A1:A11 in the properties window. The problem is that I launch...

IF problems, PLEASE HELP!!! #2
Thanks for the help!!!! But it has an error :rolleyes: It says there is an error and then highlights "getting there". An ideas -- ryangruh ----------------------------------------------------------------------- ryangruhn's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1603 View this thread: http://www.excelforum.com/showthread.php?threadid=27497 ...

help with goal seek
Hi all, I have been using goal seek to solve for the input value to my equation. my problem is that I have 100 instances to solve. column B are the desired values, column C are the input values. column D is the result of my calculation applied to the column C values column E is the difference between B and D. I've thought I could use a macro to do this, but it looks to me like macros only accept absolute references. can anyone help me on how to understand this? so as not to seem lazy, I have already searched for an answer to this without success. Maybe I am not using the correct termin...

Help With an Excel Formula
I am in excel and I have the following formula = Q:26 typed into Cell C:2. What I want to do is have a second cell D:2 that takes what ever cell reference I enter into C:2 and adds 1 row to it. So cell D:2 would be equal to Q:27, which is 1 row down from row Q:26. Is there a way to do this? Not possible unless you use an add-in or user define function that reads the text of the formula in C2 D McRitchie has UDF for that http://www.mvps.org/dmcritchie/excel/formula.htm then you could use =OFFSET(INDIRECT(SUBSTITUTE(getformula(C2),"=","")),1,) Regards, Peo Sjobl...

Help simplifying a SUMPRODUCT formula
The following SUMPRODUCT formula produces the correct results but I'm reasonably certain that there must be a more efficient way of constructing the formula. There are basically two components to this formula separated by the + sign. Each component performs the same calculation: the first part for Class="MS" and the second part (after the +) for Class="MSTV". Isn't there a way to construct the formula so that it would be calculated for Class="MS" OR Class="MSTV" and eliminate the need for two steps? I tried to incorporate the OR formula wi...

conditional formatting help please
greetings......i have a row in which if say a4 contains the word help, then all that row is in red text, othewise it is in black text a1 a2 a3 a4 a4 dept author title help low so that if a4 says help..... help me or help now etc....... the whole row is red thanks in advance K Hello 1. Select row 4 and choose Format > Conditional formatting 2. Choose "Formula is" and enter this formula: =SEARCH("help",$A$4) It's imperative that A4 is absolute (contain $$). If not, it will change through the...

Edit box border
Hi, How can I change the border of a edit box ? Thanks "JSmith" <jsmithmitra@yahoo.com> wrote in message news:ONbQb59pEHA.556@tk2msftngp13.phx.gbl... > > Hi, > How can I change the border of a edit box ? From what to what? -- Jeff Partch [VC++ MVP] Hi Jeff, As default they have borders I want to disappear it. Like we do it thru its properties. Thanks in advance "Jeff Partch" <jeffp@mvps.org> wrote in message news:%23yB0C99pEHA.1300@TK2MSFTNGP12.phx.gbl... > "JSmith" <jsmithmitra@yahoo.com> wrote in message > news:ONb...

Data Analysis help?
Hi all, I've got some time series data which is approximately constant for awhile, and then drops off as -(a exp(b x)). Is there a way I can have Excel help me to determine what the "best" place to consider the constant section as stopping and the exponential section as beginning? It should be straighforward to determine the exponenetial's parameters after that. Thanks for any ideas, cdj Rather than considering the range as the spline of two separate processes, can you construct a single mathematical model that covers both parts of your data? If it is possible, then...

Formula help needed
Can someone help me to shorten this formula, it slows down my computer so it takes ages to recalculate the sheet when I enter something in it. It is used to calculate time, basic formula (A2-A1+(A2<A1)) from C Pearsson�s site OFFSET(INDEX(Tid3;MATCH(A8&1;Feb!$A$9:$A$250&Feb!$B$9:$B$250;0);MATCH(Feb!$C $8;Feb!$A$8:$D$8;0);1);1;0)-INDEX(Tid3;MATCH(A8&1;Feb!$A$9:$A$250&Feb!$B$9:$ B$250;0);MATCH(Feb!$C$8;Feb!$A$8:$D$8;0);1)+(OFFSET(MATCH(Tid3;PASSA(A8&1;Fe b!$A$9:$A$250&Feb!$B$9:$B$250;0);MATCH(Feb!$C$8;Feb!$A$8:$D$8;0);1);1;0)<IND EX(Tid3;MATCH(A8&1;Feb!$A$9:$A$...

Text Box Defaults
Hi, Im trying to set a text box Default Value to a public variable in my database I have set the Default Value to = MyVariable(60) but all I get is #Name? the variable is a variant and I have checked to see that whats stored in the variable can be entered into the text box. Help! Steve - Land Down Under Steve, Is MyVariable the name of a Function? If so, I would expect it to work as the textbox's Default Value, as long as its syntax is correct. I would suspect that the #Name? error may not be related at all to this Default Value property. It is more likely to be related to the ...

To: box does not complete entry from address book
I have just switched one of my e-mail accounts from OE to Outlook. When I try to create a new message in Outlook, I start typing the name, but autocomplete does not finish the entry. I have checked in Tools to make sure autocomplete is turned on. The only way I can send a new message is to select the name from the address book. In OE, all I had to do was to start typing the name in the To: box. I must be missing something that is probably fairly obvious. To make the switch, I copied my OE contacts into the Outlook Contacts folder. Thanks for any help. Help with what? You are describing...

Auto-Fit Text Box as Default
In Publisher, can 1 setup "Best-Fit" in textbox auto-fill as default?? As it stands now, I have to go in and change it "per" document, but would like to have this always on for all my new docs Thank you H wood I don't know a way that you can do that. I am confused by the statement that you have to change it "per" document since it is a change that is made per textbox. The problem with making text boxes best fit by default is that they can't be linked to by other text boxes. -- Computing should be about insight, not numbers or flash. "Hwood&...

Character Map Help
Using Character Map, I can copy and paste a "Black Up-Pointing Triangle" (Arial, U+25B2) into the caption of label control. How can I paste this character in VBA? Patrick =-=-=-=-=-=-=-=-=-=-=-=-=- Patrick Jackman Vancouver, BC "Patrick Jackman" <pjackman at wimsey no spam com> wrote in message news:e8B0ApXZKHA.1592@TK2MSFTNGP06.phx.gbl... > Using Character Map, I can copy and paste a "Black Up-Pointing Triangle" > (Arial, U+25B2) into the caption of label control. How can I paste this > character in VBA? It's a doub...

Research box appears but doesn't actually search for anything
Whenever i try and use the research facility, it says that it is searching but always comes back with 'results not found'. I'm not looking up anything particularly wacky so there should be options there and there aren't. Help please! How do i make this work? ...

Help with Display Setting
Hi All, I designed an Excel Spreadsheet that not only contains programmed dropdowns and checkboxes, but other text line fill ins that cannot be resized due to the current design. Because of the structure, I’m now running into problems with certain users in regards to their Display setting of 120 DPI vs. the traditional 96 DPI. When I originally developed this, I set the spreadsheet to function at 100% Zoom level based on the assumption all users were set to 96 DPI. All of the checkboxes and fill ins are dependant on this setting. Without this size, the viewing screen is decreased and s...

FORMULAS please help
Hi there I am trying to create a formula that refences <> numbers in a columm then adds up the from a different columm i.e add b1:b100 only if a1:a100 is >10000 <12000 =46 a b 10000 32 9000 64 12001 86 11999 14 9990 12 One way =SUMPRODUCT(--(A1:A100>10000),--(A1:A10000<12000),B1:B10000) Regards, Peo sjoblom boogie wrote: > Hi there > I am trying to create a formula that refences <> numbers in a columm then > adds up the from a different columm > i.e add b1:b1...

Use input box to fill cells?
My question may be quite simple, but I have not been able to find any info on it (due, no doubt to ignorance) I want to use the info from an input box to fill certain cells, basically prompting the user for the info to populate the cells. Let's say that I want to put customer names in A8-A100. How can this be written to allow the user to have this info put in, be able to exit at any point, and possibly insert cells if they go beyond the range stated above? Thanks Maybe you could select the range, then do data|form? David Sizemore wrote: > > My question may be quite simple, but ...

Need help! Please....formatting?
I have a list of music that I have imported from I-tunes. The info includes the BPM's (beats per minute). The C Column which has the #'s representing the BPM's.....I would like format it in ascending order. Lowest BPM to the Highest. Can I do this and how? Any help would be appreciated. Chris Hi, Assuming you have one header row, select all cells (Ctrl + A), got Data --> Sort, select Column C (or data heading), ensure Ascending i selected, press Ok. HT -- firefyt ----------------------------------------------------------------------- firefytr's Profile: http:...

For the love of God, Please help me
I am trying to import data FROM an excel file (worsheet) into another database, but it keeps importing all the BLANK rows and columns - thousands of them. How do I just import the data entry? PLEASE, PLEASE help me! :-/ thanks. Clean up your worksheet, AWA. See: http://www.officearticles.com/excel/clean_up_your_worksheet_in_microsoft_excel.htm ************ Anne Troy www.OfficeArticles.com "AWA" <AWA@discussions.microsoft.com> wrote in message news:48218332-6E7D-4AB7-B0C1-46EC13E26515@microsoft.com... >I am trying to import data FROM an excel file (worsheet) into ano...

Help with Ask fields in Word 2007
I have a word template that I have created. I am going to be distributing this document internationally and don't want to have to manage change controls on multiple documents. Since we decided against using an Infopath form via forms services I had to scale back on the functionality in a few areas such as repeating rows and fields. That being said, I can't figure out how to accomplish something that should be rather simple. I need to ask the user to enter their region when the form template is first opened, display it in the footer. I can't figure out how to on...

Help with POP account downloading headers only
Hi hoping that someone can help with this. I have an Outlook/Exchange (2000) client configuration which includes several POP accounts. If the POP accounts are configured to download headers only, what happens to the mail on the POP server? Presumably I can click a header and the rest of the message is downloaded, but what happens to the messages for headers that I never open - do they stay on the POP server for ever? All of the POP accounts are configured to NOT leave mail on the server (or does that option automatically change if I download headers only?). If I delete message ...