How to hold an output state ?

Hi All,
I am new to arduino (but like it very much). I have connected a 7 segment display to my arduino uno via a shift register (74HC595). I developed a code which must display "2" on the seven segment display when button 1 on ir remote is pressed. But "2" must change to "3" if button 2 on ir remote is pressed and vice versa. By using the below code, 2 is displayed at the instance the code is recieved from ir transmitter and then the display resets within a few milliseconds. i want the display to show the same number unless i press another button on the ir transmitter. Any help will be appreciated.
Here is the code:

#include <IRremote.h>
const int latchPin = 5;  //Pin connected to Pin 12 of 74HC595 (Latch)
const int dataPin  = 6;  //Pin connected to Pin 14 of 74HC595 (Data)
const int clockPin = 7;  //Pin connected to Pin 11 of 74HC595 (Clock)
int i =0;
int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;
const byte numbers[16] = {
                    0b11111100,
                    0b01100000,
                    0b11011010,
                    0b11110010,
                    0b01100110,
                    0b10110110,
                    0b10111110,
                    0b11100000,
                    0b11111110,
                    0b11100110,
                    0b11101110,
                    0b00111110,
                    0b10011100,
                    0b01111010,
                    0b10011110,
                    0b11111111
};


void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver

{
  //set pins to output 
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);


}
}

void loop()
{
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
{

     if(results.value == 0xFF22DD) show(numbers[2]);
   if(results.value == 0x52A3D41F) show(numbers[2]);

   
    if(results.value == 0xFFF00F) show(numbers[3]); 
   if(results.value == 0x35A9425F) show(numbers[3]);
  
  
}
}

void show( byte number)
{
  /* Loop over each segment in the "number" we're about to display,
   * and illuminate only one segment at a time.
   */
  for(int j=0; j<=7; j++)
  {
    byte toWrite = number & (0b11011010 >> j); 
    
    
    if(!toWrite) { continue; }
    
    shiftIt(toWrite); 
  }
}


void shiftIt (byte data)
{
   
    digitalWrite(latchPin, LOW);

    for (int k=0; k<=7; k++)
    {
      // clockPin LOW prior to sending bit
      digitalWrite(clockPin, LOW); 
      
      if ( data & (1 << k) )
      {
        digitalWrite(dataPin, LOW); // turn "On"
      }
      else
      {	
        digitalWrite(dataPin, HIGH); // turn "Off"
      }

      // and clock the bit in
      digitalWrite(clockPin, HIGH); 
    }
    
    //stop shifting out data
    digitalWrite(clockPin, LOW); 
    
    //set latchPin to high to lock and send data
    digitalWrite(latchPin, HIGH);
      
}
{
  //set pins to output 
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);


}

What are the curly braces, and blank lines, for? Get rid of useless stuff == look more professional.

i want the display to show the same number unless i press another button on the ir transmitter.

What do your serial print statement show you is happening?

Thanks for your suggestion Paul.
Display means Seven Segment display, not serial monitor. I am using serial monitor just to ensure that the code from ir transmitter is being recieved properly.
Awaiting a positive reply...........

I think the problem is that you are overwriting results each time round loop, so it will stop containing the value you're looking for as soon as the transmission stops. Given that your display needs to be actively driven to produce any output and will go blank as soon as you stop calling show(), you can see that this produces the behaviour you see.

One option is to record the character you're currently displaying in a global variable and use that in the call to show().

switch(results.value)
{
    case 0xFF22DD:
    case 0x52A3D41F:
        displaying = numbers[2];
        break;

    case 0xFFF00F:
    case 0x35A9425F:
        displaying = numbers[3];
        break;
}
show(displaying);

Another possible approach is to re-write show() so that it illuminates the appropriate segments and leaves them on, rather than flashing them individually. I would have thought that the flashing approach would only be necessary if you were driving the output via a matrix, but I assume you have your LED segments connected to individual shift register outputs; doesn't that give you direct independent control over each segment?

Thanks Peter, i applaud your effort to answer my question.
As i am a newbie to arduino, Please guide me how to record the character i am currently displaying in a global variable and use that in the call to show().