I am working on a win-forms. Currently working on the .cs
class called HM_Settings.cs
which works in conjunction with HM_SettingsForm
.
I am trying to access the variables of the form items, by declaring these global variables
public Brush backgroundColor;
public Brush textColor;
public double timeOffset;
public double dateOffset;
public string title;
public bool showTitle;
public bool showText;
public HM_SettingsForm hmf = new HM_SettingsForm();
I am trying to use the form's variables by assigning them to the global variables, like so:
title = hmf.textBox1.Text;
showTitle = hmf.checkBox1.Checked;
showText = hmf.checkBox2.Checked;
The above should work. However, I am struck with this error, telling me it is inaccessible due to its protection level.
As a result, I tried changing certain values from private
to public
, but to no avail. What could I do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…