Click here to Skip to main content
16,008,010 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionService commands Pin
rmedo8-Mar-10 3:42
rmedo8-Mar-10 3:42 
AnswerRe: Service commands Pin
The Man from U.N.C.L.E.8-Mar-10 3:57
The Man from U.N.C.L.E.8-Mar-10 3:57 
GeneralRe: Service commands Pin
rmedo8-Mar-10 4:05
rmedo8-Mar-10 4:05 
GeneralSMS applications Pin
The Man from U.N.C.L.E.8-Mar-10 4:17
The Man from U.N.C.L.E.8-Mar-10 4:17 
QuestionVB6 code works like a treat but need it in vb.net grrr Pin
offroaderdan8-Mar-10 0:08
offroaderdan8-Mar-10 0:08 
AnswerRe: VB6 code works like a treat but need it in vb.net grrr Pin
offroaderdan8-Mar-10 0:45
offroaderdan8-Mar-10 0:45 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
David Skelly8-Mar-10 2:13
David Skelly8-Mar-10 2:13 
AnswerRe: VB6 code works like a treat but need it in vb.net grrr Pin
Wayne Gaylard8-Mar-10 1:03
professionalWayne Gaylard8-Mar-10 1:03 
From what I can gather, basically what you are trying to do is to read a list of players and their high scores from a text file, and populate arrays named names and scores. In .Net you need to import System.IO and use a StreamReader to read from the file. An important consideration obviously, is the set up of the original text file. i.e - is it a comma delimted file ?, is each record on a new line ? etc. I threw this together, working on a few assumptions. 1. The text file is stored in the same folder as the application executable. 2. The text file consists of a new line for each player, and each player property is separated by a comma.

names = New List(Of String)
scores = New List(Of Integer)
Dim strFilename As String = Application.StartupPath & "\highscores.txt"
Dim srScores As New StreamReader(strFilename)
While Not srScores.EndOfStream
    Dim strRead As String = srSave.ReadLine
    ListBox1.Items.Add(strRead)
    Dim strSplit() As String = Split(strRead, ",")
    names.Add(strSplit(0))
    scores.Add(strSplit(1))
End While
srScores.Close()


I also assumed names and scores were lists rather than arrays. You would obviously need to consider error handling as a major issue which I have completely ignored.
Hope this helps.
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
offroaderdan8-Mar-10 2:19
offroaderdan8-Mar-10 2:19 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
The Man from U.N.C.L.E.8-Mar-10 2:54
The Man from U.N.C.L.E.8-Mar-10 2:54 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
offroaderdan8-Mar-10 3:25
offroaderdan8-Mar-10 3:25 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
The Man from U.N.C.L.E.8-Mar-10 3:52
The Man from U.N.C.L.E.8-Mar-10 3:52 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
offroaderdan8-Mar-10 4:10
offroaderdan8-Mar-10 4:10 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
The Man from U.N.C.L.E.8-Mar-10 4:22
The Man from U.N.C.L.E.8-Mar-10 4:22 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
offroaderdan8-Mar-10 5:07
offroaderdan8-Mar-10 5:07 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
Wayne Gaylard8-Mar-10 3:13
professionalWayne Gaylard8-Mar-10 3:13 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
offroaderdan8-Mar-10 3:46
offroaderdan8-Mar-10 3:46 
GeneralRe: VB6 code works like a treat but need it in vb.net grrr Pin
Wayne Gaylard8-Mar-10 19:23
professionalWayne Gaylard8-Mar-10 19:23 
Questionerror message at runtime [modified] .... resolved Pin
Daniel Engelkes7-Mar-10 12:50
Daniel Engelkes7-Mar-10 12:50 
AnswerRe: error message at runtime Pin
TremaHD7-Mar-10 13:20
TremaHD7-Mar-10 13:20 
GeneralRe: error message at runtime Pin
Daniel Engelkes7-Mar-10 13:35
Daniel Engelkes7-Mar-10 13:35 
GeneralRe: error message at runtime Pin
TremaHD7-Mar-10 13:45
TremaHD7-Mar-10 13:45 
GeneralRe: error message at runtime Pin
Daniel Engelkes7-Mar-10 15:05
Daniel Engelkes7-Mar-10 15:05 
AnswerRe: error message at runtime Pin
RCoate7-Mar-10 18:28
RCoate7-Mar-10 18:28 
GeneralRe: error message at runtime Pin
Daniel Engelkes8-Mar-10 5:37
Daniel Engelkes8-Mar-10 5:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.