This documentation is archived and is not being maintained.

StateMachineWorkflowActivity.InitialStateName Property

Gets or sets the StateActivity in which the StateMachineWorkflowActivity will be when an instance of the state machine is created.

Namespace: System.Workflow.Activities
Assembly: System.Workflow.Activities (in system.workflow.activities.dll)

public string InitialStateName { get; set; }
/** @property */
public String get_InitialStateName ()

/** @property */
public void set_InitialStateName (String value)

public function get InitialStateName () : String

public function set InitialStateName (value : String)

Not applicable.

Property Value

The StateActivity in which the StateMachineWorkflowActivity will be when an instance of the state machine is created.

The InitialStateName property is mandatory and must be provided when a StateMachineWorkflowActivity is created. The InitialStateName of the state machine is like any other state activity that is contained within the state machine. The state activity can be a direct child of the StateMachineWorkflowActivity root activity and a StateMachineWorkflowActivity can have only one InitialStateName.

For more information about InitialStateName and CompletedStateName, see StateMachineWorkflowActivity.

The following code example shows how to set the value of the InitialStateName property. This code example is part of the SimpleStateMachineWorkflow SDK sample from the StateMachineWorkflow.cs file. For more information, see Simple State Machine.

this.Activities.Add(this.StartState);
this.Activities.Add(this.state1);
this.Activities.Add(this.CompletedState);
this.CompletedStateName = "CompletedState";
this.DynamicUpdateCondition = null;
this.InitialStateName = "StartState";
this.Name = "StateMachineWorkflow";
this.CanModifyActivities = false;

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: