I'm working in VisualStudio.
I have this Form:
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;
namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void Form1_Load(object sender, EventArgs e)
{
}
public static int signal = 0;
public void button1_Click(object sender, EventArgs e)
{
}
}
}
And this User Control:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Test
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
if (Form1.signal == 1)
{
MessageBox.Show("Signal received!", "Atention!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void UserControl1_Load(object sender, EventArgs e)
{
}
}
}
I bust my head to try to display the 'MessageBox' from 'UserControl1' when 'button1' from 'Form1' is clicked. Basically, I want to change the value of 'signal' to 1 when the 'button1' is pressed. I'm newbie but I'm pressed by time here so a good help will be very welcome. Any ideas? Thank you!