Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Stream Reader and Combo Boxes

Stream Reader and Combo Boxes

Scheduled Pinned Locked Moved Visual Basic
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    baeschliman
    wrote on last edited by
    #1

    :confused:I am stuck on a project. I have a .txt file with 8 separate lists in it. Each list is separated by a "#" sign. I need to use StreamReader to read each individual list from the file and transfer each list into a separate combo box for user selection. I can read the file but I am having trouble passing each line of a list into the combo box. Basically I only get the last line. My Code is as follows: Dim SongStreamReader As IO.StreamReader Dim Record As String If IO.File.Exists("Country.txt") Then SongStreamReader = IO.File.OpenText("Country.txt") Do Until SongStreamReader.Peek() = -1 Record = SongStreamReader.ReadLine() Me.uiList1Combo.Text = Record Loop SongStreamReader.Close() Else MessageBox.Show("File Does not exist", "Country", MessageBoxButtons.OK, MessageBoxIcon.Information) End If End Sub Any Suggestions?

    S 1 Reply Last reply
    0
    • B baeschliman

      :confused:I am stuck on a project. I have a .txt file with 8 separate lists in it. Each list is separated by a "#" sign. I need to use StreamReader to read each individual list from the file and transfer each list into a separate combo box for user selection. I can read the file but I am having trouble passing each line of a list into the combo box. Basically I only get the last line. My Code is as follows: Dim SongStreamReader As IO.StreamReader Dim Record As String If IO.File.Exists("Country.txt") Then SongStreamReader = IO.File.OpenText("Country.txt") Do Until SongStreamReader.Peek() = -1 Record = SongStreamReader.ReadLine() Me.uiList1Combo.Text = Record Loop SongStreamReader.Close() Else MessageBox.Show("File Does not exist", "Country", MessageBoxButtons.OK, MessageBoxIcon.Information) End If End Sub Any Suggestions?

      S Offline
      S Offline
      sanjivji
      wrote on last edited by
      #2

      go for string.split

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups