vb.net - How do I create text file with 2 variable in it? -


i have program saves name , score. stores name , score in 2 different files. display them high scores 2 listboxes.

i know possible along lines of ('score|name') , call , split pipe. want able save number , name in sort of format , call in listbox , have largest number , corresponding name show in label "highscore held {name} {number}!"

alternatively, project has 3 variables: type, mode , difficulty, along name , score. possible save ('type|mode|diff|score|name') , check correct mode etc. each page on high scores page.

i not wording well, can upload entire code github if need be. have done in round-about way.

i have posted relevent code below.

sub aa1()     dim file_name string = system.io.path.combine(my.computer.filesystem.specialdirectories.mydocuments, "calculator\addition\attack\1.txt")     dim arytext(0) string     arytext(0) = mdiparent1.overall     dim objwriter new system.io.streamwriter(file_name, true)     objwriter.writeline(arytext(0))     objwriter.close()     msgbox("score , name saved") end sub 

\\

sub aan1()     dim file_name string = system.io.path.combine(my.computer.filesystem.specialdirectories.mydocuments, "calculator\addition\attack\name\1.txt")     dim arytext(0) string     arytext(0) = mdiparent1.username     dim objwriter new system.io.streamwriter(file_name, true)     objwriter.writeline(arytext(0))     objwriter.close()     'msgbox("score , name saved") end sub 

\\

sub file_createaa()     dim filepath string = system.io.path.combine(my.computer.filesystem.specialdirectories.mydocuments, "calculator\addition\attack\1.txt")     if not system.io.file.exists(filepath)         system.io.file.create(filepath).dispose()     end if end sub 

\\

sub file_createaan()     dim filepath string = system.io.path.combine(my.computer.filesystem.specialdirectories.mydocuments, "calculator\addition\attack\name\1.txt")     if not system.io.file.exists(filepath)         system.io.file.create(filepath).dispose()     end if end sub 

you can try (vb.net code now)

    dim name list(of string)     dim score list(of integer)     dim delimiter string = "@@@"     dim objwriter new system.io.streamwriter(file_name, true)      integer = 0 name.count() step 1         objwriter.writeline(name(i) + delimiter + score(i).tostring())     next      objwriter.close() 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -