Use listbox not textfile


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Use listbox not textfile

  1. #1
    Join Date
    Jan 2011
    Posts
    1

    Use listbox not textfile

    hi
    how would i go about changing this code to use a listbox and not this path to file thanks.("C:\TestText.txt")
    Code:
    Public Class Form1
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim s() As String = System.IO.File.ReadAllLines("C:\TestText.txt")
        MessageBox.Show(s(0)) 'First Line
        MessageBox.Show(s(1)) 'Second Line
      End Sub
    End Class

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Code:
    Dim FileName As String = lstBox.SelectedItem.ToString()
    Dim s() As String = System.IO.File.ReadAllLines(FileName)
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Seach within a listbox
    By Vulcan1500 in forum Database
    Replies: 2
    Last Post: 06-06-2008, 01:05 PM
  2. how to bind the listbox and textbox
    By JenHu in forum .NET
    Replies: 1
    Last Post: 06-12-2006, 07:34 PM
  3. Replies: 4
    Last Post: 03-19-2006, 11:10 PM
  4. ListBox API
    By Steve J Golem in forum VB Classic
    Replies: 2
    Last Post: 12-09-2000, 10:38 PM
  5. ListBox API
    By Steve J Golem in forum VB Classic
    Replies: 0
    Last Post: 12-09-2000, 09:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center