title: how to send more than 2 arguments in a click event handler in Visual C++ (delegate => thing isnt working)
body: <p>this is what im doing right now !!! </p>
  
  <pre><code>//picture box
  pct-&gt;Click += gcnew EventHandler(this,&amp;fornow::Form1::Display);
  
  private: System::Void Display(System::Object^ sender, System::EventArgs^ e){
      PictureBox^ pb = safe_cast&lt;PictureBox^&gt;(sender);
      pictureBox1-&gt;Image = pb-&gt;Image;
  }
  </code></pre>
  
  <p>Apparently I cannot use delegates in C++/Cli  im pretty new to this kind of coding !! So could anyone tell me how to send some more arguments to the eventhandler method after clicking so i can use it in the code there !!!</p>
  
  <p>Like I have a System::String , if I could send it like this may be i could write</p>
  
  <pre><code>private: System::Void Display(System::Object^ sender, System::EventArgs^ e, System::String^  s){
      Mat img = imread(s);
      imshow("",img);  
      waitKey(0);
  }
  </code></pre>
  
  <p>im compiling it with /clr and im using trial version vs 2010
  Visual C++ .</p>
  
  <p>this code resides in a buttonclick event handler... ive added that part of the code ...</p>
  
  <pre><code>private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
      // array&lt;System::String^&gt;^ files = 
      //     System::IO::Directory::GetFiles(textBox1-&gt;Text,"*.*",
      //     System::IO::SearchOption::AllDirectories);
  
  
      pin_ptr&lt;const wchar_t&gt; wch = PtrToStringChars(textBox1-&gt;Text);
      wchar_t wch1[260];
      wcscpy(wch1,wch);
      list&lt;basic_string&lt;wchar_t&gt;&gt; dir;
      list&lt;string&gt; s;
      retrieve *r = new retrieve();
  
  
      dir = r-&gt;print(wch1,dir);
  
      for(list&lt;basic_string&lt;wchar_t&gt;&gt;::iterator itr = dir.begin(); itr != dir.end();itr++)
      {
          cout&lt;&lt;std::string(itr-&gt;begin(),itr-&gt;end())&lt;&lt;endl;
          s.push_back(std::string(itr-&gt;begin(),itr-&gt;end()));
      }
  
      filter *f = new filter();  
      s=f-&gt;filter1(s); // fills s with paths (strings)
      flowLayoutPanel1-&gt;Controls-&gt;Clear();
  
      for(list&lt;string&gt;::iterator i=s.begin();i!=s.end();i++)
      {
          std::string sn = std::string(i-&gt;begin(),i-&gt;end());
          System::String^ s = gcnew System::String(sn.c_str());
  
          PictureBox^ pct = gcnew PictureBox();
          if(checkBox1-&gt;Checked==true)
              pct-&gt;Image = Image::FromFile(s)-&gt;GetThumbnailImage(50,50,nullptr,System::IntPtr::Zero);
          if(checkBox1-&gt;Checked==false)
              pct-&gt;Image = Image::FromFile(s);
  
          pct-&gt;Size = System::Drawing::Size(100,100);
          flowLayoutPanel1-&gt;Controls-&gt;Add(pct);
          pct-&gt;Click += gcnew EventHandler(this,&amp;fornow::Form1::Display);
          Mat img = imread(sn);
          imshow(sn,img);
          waitKey(0);
      }
  </code></pre>
  
  <p>Im sorry im really new to this kind of coding .. any suggestions will be helpful thanks !!!</p>