how to access a claim in another class c# code example
Example 1: accessing form controls from another class c#
public partial class Form1 : Form
{
private static Form1 form = null;
private delegate void EnableDelegate(bool enable);
public Form1()
{
InitializeComponent();
form = this;
}
public static void EnableStaticTextBox(bool enable)
{
if (form != null)
form.EnableTextBox(enable);
}
private void EnableTextBox(bool enable)
{
if (InvokeRequired)
{
this.Invoke(new EnableDelegate(EnableTextBox), new object[] { enable });
return;
}
textBox1.Enabled = enable;
}
}
Example 2: access label from another class c#
public static Form1 form = null;
public Form1()
{
InitializeComponent();
form = this;
}
Form1.form.label1.Text = "Hello, World!";