Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
this is my code

C++
private: System::Void btnMul_Click(System::Object^  sender, System::EventArgs^  e) {

    if(isMul == false){
        ice->(false,8000,6000);/***/
        unsigned long data = 10;
        unsigned long value;
        value=5*data;
        String^ str = value.ToString();
        textBox1->Text=str;
        
        isMul=true;
        
    }
    
    else
    
    {
    
        textBox1->Text = "";
        
        isMul=false;
        
    }

I am working on windows form application,I am using one button, in that when i click first it will do the multiplication operation, second when i click it will do the delete operation. then when i again click it have to the delete operation.
First time it is working perfectly, 2nd time i want to change the (Stared line)
ice->(true,8000,6000);
Posted
Updated 14-Oct-13 3:03am
v2

1 solution

Use a class or static variable which you can set each time through this code; something like:
C++
private: System::Void btnMul_Click(System::Object^  sender, System::EventArgs^  e) {
    static bool isMul = false;
 
    if(isMul == false){
        ice->(isMul, 8000, 6000);// I am not sure of the validity of this statement
        unsigned long data = 10;
        unsigned long value;
        value=5*data;
        String^ str = value.ToString();
        textBox1->Text=str;
        
        isMul=true;
    }
    else
    {
        ice->(isMul, 8000, 6000);// I am not sure of the validity of this statement
        textBox1->Text = "";
        isMul=false;
        
    }
 
Share this answer
 
v2
Comments
Mahesh S Banger 14-Oct-13 9:25am    
@ Richard MacCutchan
Please write the code snippet in dis way for my code...
Richard MacCutchan 14-Oct-13 9:35am    
What do you mean for your code? Are you saying you cannot figure out something as simple as a variable and an if statement?
Mahesh S Banger 14-Oct-13 10:18am    
Ya, I am biggener to C++.Please dont mind.
Richard MacCutchan 14-Oct-13 10:55am    
See my updated solution, although I am not sure exactly what you want to happem, so it is something of a guess.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900