System.ComponentModel.ComponentResourceManager.ApplyResources C# (CSharp) Method

ApplyResources() public method

This method examines all the resources for the current culture. When it finds a resource with a key in the format of "[objectName].[property name]" it will apply that resource's value to the corresponding property on the object. If there is no matching property the resource will be ignored.
public ApplyResources ( object value, string objectName ) : void
value object
objectName string
return void
        public void ApplyResources(object value, string objectName)
        {
            ApplyResources(value, objectName, null);
        }

Same methods

ComponentResourceManager::ApplyResources ( object value, string objectName, CultureInfo culture ) : void

Usage Example

 private void InitializeComponent()
 {
     ComponentResourceManager manager = new ComponentResourceManager(typeof(HistoryOptionControl));
     PropertyValue value2 = new PropertyValue();
     PropertyValue value3 = new PropertyValue();
     this.chkHistoryEnabled = new CheckBox();
     this.btnClearHistory = new Button();
     this.ValuesWatcher = new PropertyValuesWatcher();
     ((ISupportInitialize) this.ValuesWatcher).BeginInit();
     base.SuspendLayout();
     manager.ApplyResources(this.chkHistoryEnabled, "chkHistoryEnabled");
     this.chkHistoryEnabled.Checked = true;
     this.chkHistoryEnabled.CheckState = CheckState.Checked;
     this.chkHistoryEnabled.Name = "chkHistoryEnabled";
     this.chkHistoryEnabled.UseVisualStyleBackColor = true;
     manager.ApplyResources(this.btnClearHistory, "btnClearHistory");
     this.btnClearHistory.Name = "btnClearHistory";
     this.btnClearHistory.UseVisualStyleBackColor = true;
     this.btnClearHistory.Click += new EventHandler(this.btnClearHistory_Click);
     value2.DataObject = this.chkHistoryEnabled;
     value2.PropertyName = "Checked";
     value3.DataObject = this.btnClearHistory;
     value3.PropertyName = "Enabled";
     this.ValuesWatcher.Items.AddRange(new PropertyValue[] { value2, value3 });
     manager.ApplyResources(this, "$this");
     base.AutoScaleMode = AutoScaleMode.Font;
     base.Controls.Add(this.btnClearHistory);
     base.Controls.Add(this.chkHistoryEnabled);
     base.Name = "HistoryOptionControl";
     ((ISupportInitialize) this.ValuesWatcher).EndInit();
     base.ResumeLayout(false);
     base.PerformLayout();
 }
All Usage Examples Of System.ComponentModel.ComponentResourceManager::ApplyResources