I have two forms
Form 1: Contains
1. Trackbar (adjusts opacity of form 2)
2. Button ( to show form 2)
Form 2: Contains
1. only trackbar (adjusts opacity of form 1)
I m able to control only opacity of form 2 via form1, I want it to be vice versa!
Here is the code, I get 'StackOverFlowException' was unhandled error in 14 line of form 1
Form 1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace formaccesstest
{
public partial class Form1 : Form
{
Form2 frm2 = new Form2();
public Form1()
{
InitializeComponent();
}
private void form2btn_Click(object sender, EventArgs e)
{
frm2.Show();
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
frm2.Opacity = trackBar1.Value * 0.01;
}
}
}
and form 2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace formaccesstest
{
public partial class Form2 : Form
{
Form1 frm1 = new Form1();
public Form2()
{
InitializeComponent();
}
private void form1btn_Click(object sender, EventArgs e)
{
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
frm1.Opacity = trackBar1.Value * 0.01;
}
private void Form2_Load(object sender, EventArgs e)
{
}
}
}