Sorry if I am brief I have to get my son soon I just wanted to post so I could hopefully get some answers and understand what I am doing wrong. I know this is homework and I should not ask it but I am stuck, I do not want code hand outs also do not want really involved ways of doing this as we are not deep into VB yet.
Ok, so here is the code for my program. We are making a membership list and it needs to load with just the names in the txt file that is in the debug bin. The txt file is set up in one column and holds the member name and the next line is member number and so on. Information is read into an "array of structures" and the display is supposed to be ONLY the names in the listbox on load. This is my problem. I had it displaying all th txt file info and I just need the names. I tried what you will see in the code but it is not working and my book is less then helpful when it comes to examples and/or knowledge on the subject. Though it could be too many hours spent trying to get it to work.
Imports System.IO Public Class frmMemberList Structure Members Dim member As String Dim number As Integer End Structure Const FOLDER As String = "MEMBERPHONES.TXT" Dim data() As Members Private Sub frmMemberList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load getData() displayData() End Sub Sub getData() Dim i As Integer Dim sr As StreamReader = File.OpenText(FOLDER) Do While (sr.Peek <> -1) i += 1 data(i).member = sr.ReadLine data(i).number = sr.ReadLine Loop sr.Close() End Sub Sub displayData() lstDisplay.Items.Clear() For i As Integer = 0 to () lstDisplay.Items.Add(String.Format(data(i).member)) Next End Sub
I appreciate any help I can get. I think I have the other functions I need done, just need to get the display up and running to test.