Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Visual Basic code > Modeling Visual Basic code in a model > Modeling a Visual Basic field in a model (Visual Basic code)
  
Modeling a Visual Basic field in a model (Visual Basic code)
A Visual Basic field is modeled through a Modeler Attribute or Role:
Use an Attribute when the type of the field is not a class, structure, interface or module.
Use a Role when the type of the field is a class, structure, interface or module.
To model a Visual Basic field through an attribute in a model:
1. In Modeler, right-click the Class, Data Type or Interface that models the element that is to own the field, point to New, and then click Attribute.
2. Type the name of the field, and then press the Enter key.
3. Right-click the Attribute, point to Links > Stereotypes, and then click VB Attribute.
4. Open the Attribute's Property Pages, and then click the Optionstab.
5. On the Data Type tab, click the Select button, and then select the item that is to be the type of the field.
6. If you want to generate a shared field, select the On Class option.
7. If you want to generate a const, select the Read Only check box.
8. If you want to generate a default, in the
Default box, type the default value of the field.
9. On the General tab, set the Visibility property as required.
10. On the VB Attribute tab, set the values of the Tag Definitions (applied by the «VB Attribute» stereotype) as required.
For more information about how ACS generates the values of an Attribute's standard properties and Tag Definitions, see the related links below.
For information about setting the tagged value of a Tag Definition, see the related links below.
To model a Visual Basic field through a role in a model:
1. On a Class Diagram, create an Association from the Class, Data Type or Interface that models the class, structure, interface or module that is to own the field; to the Class, Data Type or Interface that models the class, structure, interface or module that is to be the type of the field.
2. In the Packages pane, expand the Class, Data Type or Interface that is to own the field, and locate the Role you have created through the Association.
3. Set the name of the Role to that of the field you want to create.
4. Open the Role's Property Pages, and then click the Options tab.
5. If you want to generate a shared field, select the On Class option.
6. If you want to generate a default, in the Default box, type the default value of the field.
7. On the General tab, set the Visibility property as required.
8. Set the values of the Role's standard properties and Tag Definitions (applied by the «VB Role» stereotype) as required
For more information about how ACS generates the values of a Role's standard properties and Tag Definitions, see the related links below.
For information about setting the tagged value of a Tag Definition, see the related links below.