SPForm Class

Represents a form creating, displaying, or editing a list item in a list.


Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

<SubsetCallableTypeAttribute> _
Public Class SPForm
Dim instance As SPForm

Use the Forms property of the SPList class to return an SPFormCollection object that represents the collection of forms for a list, and use an indexer to return a single form from the collection. For example, if the collection is assigned to a variable named collForms, use collForms[index] in C#, or collForms(index) in Visual Basic, where index is either the index number of the form in the collection or the name of the form page.

The following code example iterates through all forms for the Contacts list of the current site and displays their site-relative URLs and types.

Dim site As SPWeb = SPControl.GetContextWeb(Context)
Dim list As SPList = site.Lists("Contacts")
Dim forms As SPFormCollection = list.Forms
Dim form As SPForm

For Each form In  forms
    Response.Write(form.Url & " :: " & form.Type & "<BR>")
Next form

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.