allan wrote:
 
i agree...why use a list box? how about if you need some columns? it's more convenient to populate records in a msflexgrid control.

ILyas <[EMAIL PROTECTED]> wrote:
how abt using a flexgrid instead of a list box?
ILyas


From: Boyd Spangler [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 24, 2004 6:32 AM
To: [EMAIL PROTECTED]
Subject: Re: PSC Listbox.listcount OVER 32000 ..and filelength

Your question was intersting as I have never heard of anyone using 32000 items in a list box. So I ran a test.
1. It will hold more than 32767 items and starts to count backwards.
2. You can not set the list index above 32767. You get an error.
3. You can not set the list index to a negitave number. You get an error.
4. You can select an item above 32767 and you get back the item and the negitave number.
So you will not be able to loop thru the list.
To get the list count you can use the following code:
Dim Y as long
y=List1.ListCount
If y<0 then y = 32768 + Abs(y + 32768)
I would suggest using 2 list boxes. When an Item is to be inserted then check the ListCount of ListBox1 and if it is 32767 then place the item in ListBox2.
 
Following code might help you:
 
Option Explicit
Dim Counter As Long, fileOutput As String
 
Private Sub Command1_Click()
    Counter = 1
    Open "c:\test" & Counter & ".txt" For Output As #1
    PrintOutput List1
    PrintOutput List2
    Print #1, fileOutput
    Close #1
End Sub
 
Private Sub PrintOutput(lb As ListBox)
    Dim i As Long
    For i = 1 To lb.ListCount - 1
        DoEvents
        fileOutput = fileOutput & lb.List(i)
        If Len(fileOutput) > 500000 Then
            Print #1, fileOutput
            Close #1
            fileOutput = ""
            Counter = Counter + 1
            Open "c:\test" & Counter & ".txt" For Output As #1
        End If
    Next
End Sub
Wayne

udtmang <[EMAIL PROTECTED]> wrote:

Greetings all..

     I have what I THINK are 2 fairly simple questions which I can't
grasp the answer, appears just out of reach.

Question #1: How do I display a listboxes listcount if the listcount
is over 32,000 without getting the - character and it counting
backwards ? I have tried such things as dim listcount as long but
that didnt work.

Question #2: These items that appear in a listbox I am saving to a
file, however if the listcount is over say 7,000 items, it makes a
rather huge text file. I am trying to do some sort of save listbox
function that if the size of the file is say, over 500k, it closes
and reopens another file and continues the save.

Here is the save code i am currently using:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub mnusavepath3_Click()

Dim f As Integer, i As Integer
Dim name As String
    name = txtip.Text
    f = FreeFile

Open App.Path & "\" & name & " savedpath3.txt" For Append As f
     For i = 0 To List1.listcount - 1
        If i > 0 Then
           Print #f, txtdir.Text & List1.List(i)
                Else
        If i < 1 Then
                   End If
                        End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
What i am thin king is to close it at say 10,000 items, then open
another file, [in some sort of continued naming scheme like
savedpath3a.txt] countinuing on with the save function untill
all items are written to the files


Should i use a "len" function, or maybe an array of some sort ?





To unsubscribe, send an email to:
[EMAIL PROTECTED]





Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

To unsubscribe, send an email to:
[EMAIL PROTECTED]






To unsubscribe, send an email to:
[EMAIL PROTECTED]





Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

To unsubscribe, send an email to:
[EMAIL PROTECTED]




Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=510419293


Yahoo! Groups Links

Reply via email to