5 Replies - 856 Views - Last Post: 14 March 2012 - 04:52 PM Rate Topic: -----

#1 bredagilson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-March 12

sequential text file to list box

Posted 14 March 2012 - 04:21 PM

Hey everybody. So confused right now, had a sequential text file loading into a list box this afternoon, opened the programme a few minutes ago and its not working! The text file was loading first name and surname onto the same line, but now it will only put the first name into it. I'm new to VB and to textfiles, so can anyone see any problem with the code below that would be causing this problem? Any help would be greatly appreciated!

Private Sub frmSelection_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim Datafile() As String = IO.File.ReadAllLines("Datafile.txt")
        Dim query = From line In Datafile
                    Let name = line.Split(","c)(0)
                    Let surname = line.Split(","c)(1)
                    Order By name
                    Select name, surname 


        lstNames.DataSource = query.ToList


    End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: sequential text file to list box

#2 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: sequential text file to list box

Posted 14 March 2012 - 04:25 PM

this is probable stupid but i take it the txt file is still in the same place as you left it this morning.
Was This Post Helpful? 0
  • +
  • -

#3 bredagilson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-March 12

Re: sequential text file to list box

Posted 14 March 2012 - 04:30 PM

It certainly is yes. Do you think there is any problem with the code?
Was This Post Helpful? 0
  • +
  • -

#4 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: sequential text file to list box

Posted 14 March 2012 - 04:33 PM

I can't see a problem but if have never use Let but just had a look on msdn on how to use let seem to correctly used have you tried using break points to step through your code.

This post has been edited by m_wylie85: 14 March 2012 - 04:37 PM

Was This Post Helpful? 0
  • +
  • -

#5 bredagilson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-March 12

Re: sequential text file to list box

Posted 14 March 2012 - 04:43 PM

thanks! any other suggestions?
Was This Post Helpful? 0
  • +
  • -

#6 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: sequential text file to list box

Posted 14 March 2012 - 04:52 PM

Yeah upload your program and text file and i will have a look see if i can spot the problem.

Hey chum just to let you know if you don't upload or let me know what your doing soon i am gonna just go to bed

This post has been edited by m_wylie85: 14 March 2012 - 05:08 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1