Most often we are accustomed with the out-of-the-box functionalities in SharePoint to start a workflow attached with a list / library.There might be a requirement where the workflow needs to be started manually from within a programming interface i.e. a custom form which can be used for triggering workflow on specific list / library items.
An example for the above requirement is provided below using VB.Net as the programming language.
Dim list As SPList = web.Lists("ListName") Dim lstItem As SPListItem = list.GetItemById(itemID) 'obtain an instance of SPWorkflowManager which will be used to start the workflow Dim manager As SPWorkflowManager = site.WorkflowManager 'get all workflows associated with the list Dim associationCol As SPWorkflowAssociationCollection = list.WorkflowAssociations 'iterate through all the workflow and lookup for the workflow to be started For Each association As SPWorkflowAssociation In associationCol If association.Name = "WorkflowName" Then 'get workflow association data Dim assData As String = association.AssociationData 'start the workflow manager.StartWorkflow(lstItem, association, assData) Exit For End If Next