My problem is simple. I want to click a panel in Form1, this will cause label1 in a userControl1 which is placed upon form2 to change to "Text".
Clicking this panel would also change the background color of said userControl1. I receive the error "'TileInterFaceTest.Usercontrol1.label1' due to its protection level" which frankly baffles me.
Even running the color change code separately, it simply doesn't achieve the desired result.
To be clear, I'm quite a novice when it comes to C# and programming in general. I've been working with Visual Basic until now so the concept of classes, methods and objects are slightly confusing to me.
Here is my 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;
namespace TileInterFaceTest
{
public partial class Form1 : Form
{
public UserControl1 userControl1 = new UserControl1();
public Form2 form2 = new Form2();
public Form1()
{
InitializeComponent();
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
private void panel1_DoubleClick(object sender, EventArgs e)
{
}
private void panel1_Click(object sender, EventArgs e)
{
form2.Show();
userControl1.BackColor = System.Drawing.Color.Red;
userControl1.label1 = "Text";
}
}
}