BelfraGadisco
BelfraGadisco

Reputation: 1

ListBox Control: First Row Disappears

REPOST from my question yesterday. Complete code below: I think the problem is at .Column = MyArray where I send the values into the Listbox thru .column instead of .additem. But i can't figure out how to .additem an array.

Option Explicit
Dim MyArray As Variant
Dim n As Integer

Private Sub UserForm_initialize()
n = 0
End Sub

Private Sub FBcv_aDD_Click()
ReDim MyArray(4, n)
Dim i As Long
'============================================
If ListBox_FB.ListIndex = True Then
    MyArray(0, n) = "Cavity Fixing Block"
    MyArray(1, n) = FBcv_L.Value & " x " & FBcv_W.Value & " x " & FBcv_T.Value
    If FBcv_Qty <= 1 Then
        MyArray(2, n) = FBcv_Qty.Value & "pc."
    ElseIf FBcv_Qty > 1 Then
        MyArray(2, n) = FBcv_Qty.Value & "pcs."
    End If
    MyArray(3, n) = FBmat.Value
    MyArray(4, n) = FBcv_uPRICE.Value
n = n + 1
End If
'============================================
With ListBox_FB
    For i = 0 To ListBox_FB.ListCount - 1
        If ListBox_FB.ListIndex = False Then
            .AddItem ListBox_FB.List(i, 0)
            ListBox_FB.List(ListBox_FB.ListCount - 1, 1) = ListBox_FB.List(i, 1)
            ListBox_FB.List(ListBox_FB.ListCount - 1, 2) = ListBox_FB.List(i, 2)
            ListBox_FB.List(ListBox_FB.ListCount - 1, 3) = ListBox_FB.List(i, 3)
            ListBox_FB.List(ListBox_FB.ListCount - 1, 4) = ListBox_FB.List(i, 4)
        End If
    Next i
    .ColumnCount = 5
    .TextAlign = 1
    .Column = MyArray
End With
End Sub

Sorry I had to repost this, i messed up with my first question.

Can anyone help me sort this out? Any help is highly appreciated. Thanks in advanCce.

Upvotes: 0

Views: 149

Answers (0)

Related Questions