OK I found some usfull code.
Here is the function which works exactly what I need but only with numbers smaller then 10.
Code:
void Combination(CString arrayN[], __int64 n_column, CString arrayR[], __int64 r_size, __int64 r_column, __int64 loop)
{
  __int64 localloop = loop;
  __int64 local_n_column = n_column;
  	
  if(r_column>(r_size-1))
  {
       CString strCombination = "";
       for(int e=0; e<r_size; e++)
	strCombination += arrayR[e];
       m_lbLista1.AddString(strCombination);
       return;
  } 
 	 	
  for(__int64 i=0;i<=loop;i++)
  {
      arrayR[r_column]=arrayN[n_column+i];
      local_n_column++;
      Combination(arrayN,local_n_column,arrayR,r_size,r_column+1,localloop);
      localloop--;
  }
}
I enter two numbers "N" and "R"(e.g. N=9, R=7, function shows all the combinations 7 of 9), then I create array "arrayN" with N elements and "arrayR" with R elements.
When the N and R are smaller then 10 it works excelent, but for any other number larger than 10 it does not work corectly.
Can somebody tel me what should be changed in the function to work with numbers larger than 10?

Last edited by shabbir; 28Aug2006 at 22:45.. Reason: Code formatting