FormBaseSetAttributeValue Method

Sets a value for the given control. When the dialog is not shown, setting a property directly for a control (such as textBox1.Text = "text") will not work for controls that have a Tekla Structures AttributeTypeName set. This method is going to have to be used to set the value.

Namespace:  Tekla.Structures.Dialog
Assembly:  Tekla.Structures.Dialog (in Tekla.Structures.Dialog.dll) Version: 2023.0.3
Syntax
public void SetAttributeValue(
	Control Ctrl,
	Object Value
)

Parameters

Ctrl
Type: System.Windows.FormsControl
The control whose value to set.
Value
Type: SystemObject
The new value. It can be of any primitive datatype supported by the control's AttributeType (normally int, double or string).
Examples
The following example shows how to use SetAttributeValue(Control, Object):
using System;
using System.Windows.Forms;
using Tekla.Structures.Dialog;
using Tekla.Structures.Dialog.UIControls;

public class Example : PluginFormBase
{
       private void MaterialCatalogSelectionDone(object sender, EventArgs e)
       {
           materialTextBox.Text = materialCatalog.SelectedMaterial;
           SetAttributeValue(materialTextBox, materialCatalog.SelectedMaterial);
       }

       private TextBox materialTextBox = new TextBox();
       private MaterialCatalog materialCatalog = new MaterialCatalog();
}
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next