DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: ListBox DataSource?

  1. #1
    Join Date
    Feb 2007
    Posts
    8

    Question ListBox DataSource?

    I hope I'm not bothering anyone by asking a lot of questions with minimal contribution to the other threads, but I am learning as I make this program. I don't know how complex it will get but all I can do is take it one step at time :P

    Heres my question: How do I popluate my "Members" listbox in the example below, using a text file? There will be more then one listbox needing the member list as you can see below. The purpose of this feature is to keep track of member's attendance and apply points each of their names which they use to purchase items in game from the Linkshell.

    http://img.photobucket.com/albums/v1...tave/Help1.png
    Last edited by NP209; 02-12-2007 at 09:55 PM. Reason: The initial Picture is no longer needed.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Code:
    Dim hFile As Integer
    Dim sText As String
    
    hFile = FreeFile
    Open "d:\path\file.txt" For Input As hFile
    Do Until EOF(hFile)
        Line Input #hFile, sText
        lstMembers.AddItem sText
    Loop
    Close hFile
    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!

  3. #3
    Join Date
    Feb 2007
    Posts
    8
    Hmm I don't think I understand this Part fully. Here is what I have tried to do, with the code you gave me. I'm sure I have left something out or not changed the right variables. The Name of the text file i wanna use is "Memberlist.txt"

    Code:
    Dim hFile As Integer
    Dim sText As String
    
    hFile = FreeFile
    Open "C:\Documents and Settings\NP209\Desktop\Linkshell Plus\Memberlist.txt" For Input As hFile
    Do Until EOF(hFile)
        Line Input #hFile, sText
        lstMembers.AddItem sText
    Loop
    Close hFile

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    What is the structure of your Memberlist.txt file? Is each item on a separate line?
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Also, is your listbox named lstMembers?
    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!

  6. #6
    Join Date
    Feb 2007
    Posts
    8



    Yes my lisbox's are named lstMembers, and my text file is structured as a 1 name per line setup.

  7. #7
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    How does my code "not work?" What happens when you run it?
    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!

  8. #8
    Join Date
    Feb 2007
    Posts
    8
    I apologize i see what i did wrong. I had changed my real name in the "Open path" line to my Screen name on here since i didn't want to release my real name. I forgot to change that back. Now that i have edited that back it works now. thanks guys your awesome ^^

Similar Threads

  1. how to bind the listbox and textbox
    By JenHu in forum .NET
    Replies: 1
    Last Post: 06-12-2006, 07:34 PM
  2. Combox Datasource & Collections
    By Jeff Johnson in forum .NET
    Replies: 4
    Last Post: 06-14-2002, 03:46 PM
  3. ListBox API
    By Steve J Golem in forum VB Classic
    Replies: 2
    Last Post: 12-09-2000, 11:38 PM
  4. ListBox API
    By Steve J Golem in forum VB Classic
    Replies: 0
    Last Post: 12-09-2000, 10:06 PM
  5. Re: How to set the DataSource to UserControl
    By Nick Koszykowski in forum VB Classic
    Replies: 0
    Last Post: 03-28-2000, 03:21 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