Visual Basic - Saving and loading a number with one digit or more to and from a .txt file -


for assignment making ball game in visual basic player gets points hitting ball. having issue saving , loading number/the highest score .txt file. far, have managed save name of player , high score .txt file, saves/loads numbers 0-9 , doesn't allow 2+ digit numbers. in advance. below code have:

to save text file

   dim filenum integer    'if player's score (lblpoints) greater high score (lblhighscore)     if lblpoints.text > lblhighscore.text         lblnewhigh.visible = true         lblhighscore.text = lblpoints.text         lblbestname.text = lblplyrname.text          'to save highscore txt file          filenum = freefile()         fileopen(filenum, "score.txt", openmode.output)         printline(filenum, lblbestname.text)         printline(filenum, lblhighscore.text)         fileclose(filenum)      end if 

to load text file

dim filenum integer      'to fetch highscore txt file     filenum = freefile()     fileopen(filenum, "score.txt", openmode.input)     lblbestname.text = lineinput(filenum)     lblhighscore.text = lineinput(filenum)     fileclose(filenum) 


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -