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. List Boxes

List Boxes

Scheduled Pinned Locked Moved Visual Basic
tutorial
4 Posts 3 Posters 1 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah

    K J L 3 Replies Last reply
    0
    • L Lost User

      Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah

      K Offline
      K Offline
      Klaus Probst
      wrote on last edited by
      #2

      Check out the SaveSetting and GetSetting functions. ___________ Klaus [www.vbbox.com]

      1 Reply Last reply
      0
      • L Lost User

        Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah

        J Offline
        J Offline
        Jason Teagle
        wrote on last edited by
        #3

        During the form's Load() procedure you would Open the file for Input, Clear() the list box, then simply call Input # on the file to get a line and AddItem() to get it into the list, for each line. If you're wondering how to know how many items there are, you should write out the number of strings (using the list box's ListCount property) to the file as the first line. Then, when you read it back in, the first thing you read is the number of lines remaining in the file to add to the list box... Does that answer your question?

        1 Reply Last reply
        0
        • L Lost User

          Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          hi, try this when you type a new string and submit write the new string into a file dim F as long f=Freefile 'to get a valid file pointer 'open and add string to existing file open "c:\tmp.txt" for append as f print #f,combo1.text close f on form load, dim F as long dim mStr as string f=Freefile open "c:\tmp.txt" for input as f do while not eof(f) line input #f, mStr combo1.additem mstr loop close f

          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