Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21755

Please help me, how to display item in listbox.

$
0
0
Dear all expert programmers,
I want to load data from array over than 32767 items. I have idea to create control array listbox instead one listbox.

Example
1. If data less than 32767 will show one listbox and show 1 to max items in listbox.
2. If data greater than 32767 it will show in next listbox

Please look my code and help me, how to display item it each listbox

Code:

Private Const lngFixItem = 32767
Private Sub DisplayItem(ByVal lngItem As Long)
    Dim i As Long
    Dim iSet As Integer
    Dim lngRemain As Integer
    If Trim$(txtItem.Text) <> "" Then
        If lst.ubound > 1 Then
            For i = lst.ubound To 1 Step -1
                Unload lst(i)
            Next
        End If
        If IsNumeric(txtItem.Text) = True Then
            iSet = CLng(txtItem.Text) / lngFixItem
            lngRemain = CLng(txtItem.Text) Mod lngFixItem
            If lngRemain > 0 Then
                iSet = iSet + 1
            End If
            If iSet > 1 Then
                For i = 1 To iSet - 1
                    Load lst(i)
                    With lst(i)
                        .Visible = True
                        .Left = (lst(i - 1).Left + lst(i - 1).Width) + 200
                    End With
                Next
               
            End If
        End If
    End If
End Sub

Private Sub Command1_Click()
    Call DisplayItem(CLng(txtItem.Text))
End Sub

Thank you for all posts.

Viewing all articles
Browse latest Browse all 21755

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>