accessing form controls from another class c#
C#
public partial class Form1 : Form
{
//https://stackoverflow.com/questions/12983427/accessing-forms-controls-from-another-class
// Static form. Null if no form created yet.
private static Form1 form = null;
private delegate void EnableDelegate(bool enable);
public Form1()
{
InitializeComponent();
form = this;
}
// Static method, call the non-static version if the form exist.
public static void EnableStaticTextBox(bool enable)
{
if (form != null)
form.EnableTextBox(enable);
}
private void EnableTextBox(bool enable)
{
// If this returns true, it means it was called from an external thread.
if (InvokeRequired)
{
// Create a delegate of this method and let the form run it.
this.Invoke(new EnableDelegate(EnableTextBox), new object[] { enable });
return; // Important
}
// Set textBox
textBox1.Enabled = enable;
}
}
Also in C#:
- Title
- system.net.mail send html message
- Category
- C#
- Title
- c# thread sleep
- Category
- C#
- Title
- dynamically add rows to datagridview c#
- Category
- C#
- Title
- c sharp comments
- Category
- C#
- Title
- c# getter setter
- Category
- C#
- Title
- how to compare datetime in c#
- Category
- C#
- Title
- date time heutiges datum
- Category
- C#
- Title
- unity how to check object position
- Category
- C#
- Title
- c# float to string
- Category
- C#
- Title
- C# sprint key
- Category
- C#
- Title
- c# type of generic is string
- Category
- C#
- Title
- what is the and in c#
- Category
- C#
- Title
- get type of variable c#
- Category
- C#
- Title
- Unity C# instantiate prefab
- Category
- C#
- Title
- how to make error sound c#
- Category
- C#
- Title
- how to track a branch on github
- Category
- C#
- Title
- response redirect new tab
- Category
- C#
- Title
- c# how to compare 2 dates without time
- Category
- C#
- Title
- south african id number validation c#
- Category
- C#
- Title
- how to edit a c# list
- Category
- C#
- Title
- countdown script in unity
- Category
- C#
- Title
- how to get array of children transform
- Category
- C#
- Title
- c# string to memorystream
- Category
- C#
- Title
- Net.ServicePointManager.SecurityProtocol .net framework 4
- Category
- C#
- Title
- built in methods to order a list c#
- Category
- C#
- Title
- appsettings in console application c#
- Category
- C#
- Title
- .net core convert keycollection to array
- Category
- C#
- Title
- c# append array
- Category
- C#
- Title
- c# web form compare dates
- Category
- C#
- Title
- linq query select top 1 c#
- Category
- C#
- Title
- how to disable a gameObject unity c#
- Category
- C#
- Title
- serilog loglevel order
- Category
- C#
- Title
- list of vectors c#
- Category
- C#
- Title
- downlaod file and use C#
- Category
- C#
- Title
- invalidoperationexception c# ui thread
- Category
- C#
- Title
- c# enum to int array
- Category
- C#
- Title
- c# silent execute exe
- Category
- C#
- Title
- unity set list of strings
- Category
- C#
- Title
- c# ^ operator
- Category
- C#
- Title
- bold caption latex
- Category
- C#
- Title
- how to add a gameobject
- Category
- C#
- Title
- how to create and trigger a function unity animation events
- Category
- C#
- Title
- c# sort array
- Category
- C#
- Title
- textblock line break
- Category
- C#
- Title
- c# ienumerable to list
- Category
- C#
- Title
- initialize enum with another enum c#
- Category
- C#
- Title
- cursorlockmode cannot be used as a method C#
- Category
- C#
- Title
- c# get value of object in enum
- Category
- C#
- Title
- unity round
- Category
- C#
- Title
- asp.net core mvc not triggering client side validation
- Category
- C#
- Title
- c# cancellationtoken
- Category
- C#
- Title
- c# creating a data recovery software
- Category
- C#
- Title
- isGrounded script for copy
- Category
- C#
- Title
- new command - latex
- Category
- C#
- Title
- same click event diffrenet buttonms c#
- Category
- C#
- Title
- unity round vector 3 to nearest integer
- Category
- C#
- Title
- unity 2d Drag object
- Category
- C#
- Title
- c# ?
- Category
- C#
- Title
- find gameobject with tag
- Category
- C#
- Title
- c# exit for
- Category
- C#
- Title
- c# replace string case insensitive
- Category
- C#
- Title
- c# merge two lists as queryable
- Category
- C#
- Title
- c# read a webpage data
- Category
- C#
- Title
- c# asp.net hover tooltip
- Category
- C#
- Title
- c# get set
- Category
- C#
- Title
- strtorime online
- Category
- C#
- Title
- foreach c#
- Category
- C#
- Title
- unity set sprite transparency
- Category
- C#
- Title
- How to search for a string from readline in c#
- Category
- C#
- Title
- c# changimg to one decimal place
- Category
- C#
- Title
- unity material offset script
- Category
- C#
- Title
- increase variable C#
- Category
- C#
- Title
- compose graphql query string in c#
- Category
- C#
- Title
- repeater itemdatabound event in c#
- Category
- C#
- Title
- c# length 2d array
- Category
- C#
- Title
- x angle oes back after 90 unity
- Category
- C#
- Title
- bind repeater to dictionary
- Category
- C#
- Title
- unity docs player input
- Category
- C#
- Title
- add text to combobox c#
- Category
- C#
- Title
- c# duplicate object instance
- Category
- C#
- Title
- zoom gedit
- Category
- C#
- Title
- usermanager change password without current password
- Category
- C#
- Title
- accessing form controls from another class c#
- Category
- C#
- Title
- c# create array of int
- Category
- C#
- Title
- c# xml file builder
- Category
- C#
- Title
- visual studio clear text script
- Category
- C#
- Title
- c# change material in code
- Category
- C#
- Title
- c# resize image keep aspect ratio
- Category
- C#
- Title
- cshtml foreach
- Category
- C#
- Title
- combine two arraylist c#
- Category
- C#
- Title
- unity get velocity of gameobject
- Category
- C#
- Title
- change canvas color uwp c#
- Category
- C#
- Title
- stop unity editor playing
- Category
- C#
- Title
- C# get all child classes of a class
- Category
- C#
- Title
- unity rb.addexplosionforce 2d
- Category
- C#
- Title
- hasmap c#
- Category
- C#
- Title
- autofixture ignore property
- Category
- C#
- Title
- asp.net core razor pages upload file
- Category
- C#
- Title
- unity c# public all codes
- Category
- C#
- Title
- unity deactive code from code
- Category
- C#