VertexBuffer.Lock Method (Int32, Type, LockFlags, Int32)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Locks a range of vertex data and obtains the vertex buffer memory.

Namespace:  Microsoft.WindowsMobile.DirectX.Direct3D
Assembly:  Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)


Public Function Lock ( _
    offsetToLock As Integer, _
    typeVertex As Type, _
    flags As LockFlags, _
    length As Integer _
) As Array
Dim instance As VertexBuffer
Dim offsetToLock As Integer
Dim typeVertex As Type
Dim flags As LockFlags
Dim length As Integer
Dim returnValue As Array

returnValue = instance.Lock(offsetToLock, _
    typeVertex, flags, length)
public Array Lock(
    int offsetToLock,
    Type typeVertex,
    LockFlags flags,
    int length
Array^ Lock(
    int offsetToLock, 
    Type^ typeVertex, 
    LockFlags flags, 
    int length
member Lock : 
        offsetToLock:int * 
        typeVertex:Type * 
        flags:LockFlags * 
        length:int -> Array 


  • offsetToLock
    Type: System.Int32
    Offset into the vertex data to lock, in bytes. To lock the entire vertex buffer, specify 0 for both sizeToLock and offsetToLock.
  • typeVertex
    Type: System.Type
    A Type that indicates the type of array data to return. This can be a value type or any type that contains only value types.
  • length
    Type: System.Int32
    The size of the array to return. If length is 0, the entire buffer is locked and the array contains all the data in the buffer.

Return Value

Type: System.Array
An Array that represents the locked vertex buffer.


Exception Condition

The method call is invalid. For example, a method's parameter may contain an invalid value.


Note that the .NET Compact Framework does not support multiple lock calls.

When using this method to retrieve an array from a resource that was not created with a type, always use the overload that accepts a type.

The Discard and NoOverwrite values for LockFlags are valid only on buffers created with Dynamic specified for Usage.

.NET Framework Security


Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also


VertexBuffer Class

VertexBuffer Members

Lock Overload

Microsoft.WindowsMobile.DirectX.Direct3D Namespace