Read values of a child windows form from the parent windows form

By [)ia6l0 iii

Create properties in child windows form and access them.

Child Form:
public partial class ChildForm : System.Windows.Forms.Form
{
   public string ChildFormProperty { get; set; }
}

public ChildForm()
{
      InitializeComponent();
      ChildFormProperty = "value is set";
}

Parent Form:

using (ChildForm cf = new ChildForm())
{
             string value = cf.ChildFormProperty;
}

Related FAQs

Use the ToString overload to convert an Integer to hex value.
Exception.ToString() contains a detailed description of the Exception with its stack trace. The Message property of the Exception object contains the smaller version of the description.
C# 4.0 provides us a new type of generics - Tuples
Named and optional parameters is a new concept introduced in 4.0. The Named Parameters allow you to pass arguments by parameter name instead of parameter position in the signature. Optional Parameters allow parameters to be specified as optional by providing a default value for them in a member declaration. When the member is invoked, optional arguments can be omitted.
You can truncate the file paths using the Shell LightWeight library.
The IndexOf method in C# is case -sensitive. However, you can use the CompareInto class to make it insensitive to case.
Read values of a child windows form from the parent windows form  (1255 Views)