title: Changing webcam brightness from another form by using trackbar in winforms
body: <p>I am trying to change the webcam brightness in Form2 by using trackbar in the Form3. I can't send the value of it or i can't use it in Form2. Since i am planning to design a UI, I need to achieve this that way. Can you help me to achieve this?</p>
  <p>This is my code of Form2 below.</p>
  <pre><code>    using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Drawing.Imaging;
  using System.Linq;
  using System.Text;
  using System.Threading;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  using AForge.Video;
  using AForge.Video.DirectShow;
  using AForge.Imaging.Filters;
  
  
  namespace MUI
  {
      public partial class Form2 : Form
      {
  
         
          public Form2()
          {
              InitializeComponent();
          }
  
          FilterInfoCollection filterInfoCollection;
          VideoCaptureDevice videoCaptureDevice;
  
          
  
          #region Webcam Frames
          private void button1_Click_1(object sender, EventArgs e)
          {
              Form3 f3 = new Form3();
              videoCaptureDevice = new VideoCaptureDevice(filterInfoCollection[comboBox1.SelectedIndex].MonikerString);
              videoCaptureDevice.NewFrame += videoCaptureDevice_NewFrame;
              videoCaptureDevice.NewFrame += f3.videoCaptureDevice_NewFrame;
              videoCaptureDevice.Start();
             
              f3.Show();
          }
          #endregion
  
          
  
          #region Bitmap Creating
          public void videoCaptureDevice_NewFrame(object sender, NewFrameEventArgs eventArgs)
          {
              pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
  
          }
          #endregion
        
  
          #region Device List
          public void Form2_Load(object sender, EventArgs e)
          {
                 
              filterInfoCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice);
              foreach (FilterInfo filterInfo in filterInfoCollection)
              {
                  comboBox1.Items.Add(filterInfo.Name);
              }
              comboBox1.SelectedIndex = 0;
              videoCaptureDevice = new VideoCaptureDevice();
  
          }
          #endregion
  
          private void Form2_FormClosing(object sender, FormClosingEventArgs e)
          {
              if (videoCaptureDevice.IsRunning == true)
              {
                  videoCaptureDevice.Stop();
                  pictureBox1.Image = null;
                  
              }
          }
      }
  }
  </code></pre>
  <p>This is my code of Form3 below.</p>
  <pre><code>    using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  using AForge.Video;
  using AForge.Video.DirectShow;
  using AForge.Imaging.Filters;
  
  namespace MUI
  {
      
      public partial class Form3 : Form
      {
          
          public Form3()
          {
              InitializeComponent();
          }
  
          
          private void trackBar1_Scroll(object sender, EventArgs e)
          {
              Form2 f2 = new Form2();
  
              label6.Text = trackBar1.Value.ToString();
              if (f2.pictureBox1.Image != null)
              {
  
  
                  BrightnessCorrection brightness = new BrightnessCorrection(trackBar1.Value);
                  f2.pictureBox1.Image = brightness.Apply((Bitmap)f2.pictureBox1.Image.Clone());
              }
          }
      }
  }
  </code></pre>