Salesforce

How Do I Get the Value of the Property of a .NET Object? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Get the Value of the Property of a .NET Object? (Magic xpa 3.x)

When you use a .NET object, you will need to access its properties. In this Calendar program, for instance, the program stores what date or date range was selected by the user.

  1. Create a handler that will execute at the appropriate time. In this example, a .NET event is used so that the handler executes when the user selects a date or date range.

  2. Create variables that will hold the returned values. In this case, the Start Date and End Date are being saved.

  3. Create expressions to access the .NET properties. These are entered by typing in or selecting the .NET variable for the calendar (A), then typing in a dot. After the dot is entered, a list of properties appears. To fetch the selection range, you need A.SelectionStart and A.SelectionEnd.

  4. Use the Magic xpa Update Variable operation to update the Magic xpa variables with the .NET expressions.

The list of properties that appears is for your convenience, and works like auto-complete for Magic xpa internal functions. You can show the list again by pressing Ctrl+Space, as you would for entering a Magic xpa function. However, you can also manually type in the entire expression:

DNSet(A.ShowWeekNumbers,B).

Note that when you create a .NET event handler, two parameters are usually created, called sender and e. These are standard .NET parameters, and you can use them within Magic xpa by using DNCast and DotNet methods to convert them into displayable values. sender is the System.Object that is raising the event. e is the System.EventArgs arguments that are being sent with the event.

Note: In this example, a simple .NET DateTime is returned from the property, and Magic xpa interprets that as needed. Some properties, however, return enumerated values, and you will need to use a .NET method to change those to a value that can be stored in a Magic xpa variable. See How Do I Use .NET Enums?.

See also

The Online and Rich Client Samples projects (program NE01 and RNE01)

Reference
Attachment 
Attachment