简体   繁体   中英

vb.net option strict disallows late binding when trying to add to array cant turn off

I am trying to build my combobox with items from my array, but am getting this error:

Here is my code:

Private Sub frmInventory_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim InvArray As Array
    InvArray = Inventory.BuildInvArray()
    Option Strict Off
    For i As Integer = 0 To 5
        cmbSystem.Items.Add(InvArray(i,1))
    Next
End Sub

It can be done by using Array.GetValue

Private Sub frmInventory_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim InvArray As Array
    InvArray = Inventory.BuildInvArray()
    For i As Integer = 0 To 5
        cmbSystem.Items.Add(InvArray.GetValue(i, 1))
    Next
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM