writing all items in listbox [problem]

Discussion in 'Programming General' started by Supah Fly, Sep 28, 2008.

writing all items in listbox [problem]
  1. Unread #1 - Sep 28, 2008 at 1:52 AM
  2. Supah Fly
    Joined:
    Aug 22, 2007
    Posts:
    202
    Referrals:
    1
    Sythe Gold:
    0

    Supah Fly Active Member
    Banned

    writing all items in listbox [problem]

    Code:
            For i = 0 To ListBox4.Items.Count() - 1
                If ListBox4.SelectedIndex = i Then
                    ListBox4.SelectedIndex = i + 1
                Else
                    ListBox4.SelectedIndex = 0
                End If
                wrf.WriteLine(ListBox4.SelectedItem)
            Next
    Ive tried alot to solve this problem, probably me being really tired.

    What it does is write all the items in a listbox, i thought of a few different ways and i guess this way would be the best. selecting every index and writing its value.

    i guessed wrong.

    fix please?

    came up with this...

    Code:
            oWrite = oFile.CreateText(SaveFileDialog1.FileName)
            Dim i As Integer, s As String
            For i = 0 To ListBox4.Items.Count - 1
                s = ListBox4.Items.Item(i)
                oWrite.WriteLine(s)
            Next i
            oWrite.Close()
    It works. Fixed it myself.
     
< Looking For Coding Assistance | easies java tutorial >

Users viewing this thread
1 guest


 
 
Adblock breaks this site