Results 1 to 2 of 2

Thread: [RESOLVED] ListBox - AddRange - Used to Work

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2019
    Location
    Sabattus
    Posts
    234

    Resolved [RESOLVED] ListBox - AddRange - Used to Work

    Below is some code that worked perfectly fine in another one of my VB apps.

    Copy pasted the code.... and now the listbox doesn't populate even though there is 9 lines in the TXT file.

    Lines in the TXT file

    OpenBalCHK
    OpenBalSAV
    OpenBalCSH
    AllocatedinCHK
    Bill
    Checking
    Savings
    Assets
    Cash
    I am not sure why it doesn't work in this new app.

    Any Ideas...

    Code:
    Public Sub loadLstACCT()
            'Public lstACCTPath = txtDefPath.Text & "mmslistaccounts.txt"
            Try
                'CLEAR LIST
                lstACCT.Items.Clear()
    
                'LOAD FILE
                Dim lines() As String = IO.File.ReadAllLines(lstACCTPath)
                lstACCT.Items.AddRange(lines.ToArray())
            Catch Err As Exception
                MessageBox.Show(Err.Message)
            End Try
    End Sub
    I am trying to see what the loaded file looks like, but can't seem to figure out why I can't convert it to a string.

    FYI... in the debugger I generate no errors.

    Thanks
    Last edited by pixelink; Sep 18th, 2020 at 12:29 PM.
    Can't Type - Forgetful - Had Stroke = Forgive this old man!
    Website: https://pixelinkmedia.wixsite.com/frankhilton
    VSCOMM 2022 • LAZARUS 2.2.0 • Win10 • 16G RAM • Nvida GForce RTX 2060

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Apr 2019
    Location
    Sabattus
    Posts
    234

    Re: ListBox - AddRange - Used to Work

    I must be getting tired.... I had a call wiping out the text after it was loaded.

    Sorry for all this.

    Last edited by pixelink; Sep 18th, 2020 at 01:53 PM.
    Can't Type - Forgetful - Had Stroke = Forgive this old man!
    Website: https://pixelinkmedia.wixsite.com/frankhilton
    VSCOMM 2022 • LAZARUS 2.2.0 • Win10 • 16G RAM • Nvida GForce RTX 2060

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width