LoadArray example for Visual Basic

Private Sub LoadArray_Click()
    Dim buf(30000) As Byte
    Dim RasterIO As New LEADRasterIO
    Dim RasterVar As New LEADRasterVariant
    Dim i As Integer
    Dim size As Integer
    Open "c:\image1.cmp" For Binary Access Read As #1
       Get #1, , buf
       size = UBound(buf) – LBound(buf) +1
       RasterVar.Type = VALUE_ARRAY_BYTE
       RasterVar.ItemCount = size
       For i = 0 To RasterVar.ItemCount - 1
          RasterVar.ShortItemValue(i) = buf(i)
       Next
       RasterIO.LoadArray LEADRasterView1.Raster, _
                   RasterVar, 0, 0, -1, _
                   size
    Close #1
End Sub