Hello again,
I am having a little bit of problem with my coding.
Basically I have a form(mainForm) where I have a button to select a video device which directs me to a new form(deviceForm). Then I choose a device from a comboBox(deviceBox) and press the "Select" button. This would redirect me back to the mainForm and display the video on a picture box(pictureBox1).
Here is where I am having difficulties with. I can't seem to redirect from deviceForm to mainForm and have the video displayed.
What code should I put in the "Select" button on deviceForm?
This is what I put in the code.
public void btnSelect_Click(object sender, EventArgs e)
{
mainForm form1 = new mainForm();
selectDevice = new //VideoCaptureDevice(device[deviceBox.SelectedIndex].MonikerString);
this.Hide();
form1.show(????)
}
and in mainForm I have this for the picture box
private void pictureBox1(object sender, NewFrameEventArgs eventArgs)
{
deviceForm form2 = new deviceForm();
selectDevice = new VideoCaptureDevice(device[form2.deviceBox.SelectedIndex].MonikerString);
Bitmap img = (Bitmap)eventArgs.Frame.Clone();
this.Image = img;
I was able to display feed from the webcam on a single form but I can't do it on another form.
I also included
using AForge.Video;
using AForge.Video.DirectShow;
On the mainForm, the code line
VideoCaptureDevice(device[form2.deviceBox.SelectedIndex].MonikerString);
has an error on deviceBox, it says inaccessible due to it's protection.
Oh yeah, if this help I am using the latest version of AForge.Net framework and visual studio 2010 ultimate, running on vista sp3 and usb webcam of modal CrystalEye. Doing it on C#(obviously lol)
Hope the veterans can help me in solving this simple problem.
Thanks