在已经存在的文本文件VB.NET中写文本 [英] Write Text In A Already Existing Text File VB.NET

查看:150
本文介绍了在已经存在的文本文件VB.NET中写文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发街机游戏,并且作为每款出色的街机游戏,它都集成了计分板,以便玩家可以看到谁得分更高.我的问题是,每次输入新的记分线时,它将删除文本文件中的所有先前行.我一直在使用的代码如下:

I've been developing a arcade game, and as every good arcade game, it has an incorporated scoreboard so that players can see who scored better. My problem is that everytime it enters a new scoreline, it deletes all the previous lines in the text file. The code I've been using is the following:

    If player1 > 25 Then

        objReader.Close()
        MsgBox("O " + jogador1 + " ganhou.")
        tab1.Enabled = False

        Dim wrtScore As String = "C:\Documents and Settings\Joao\My Documents\Visual Studio 2010\Projects\flaghunter\flaghunter\deposito\scores.txt"
        Dim objWriter As New System.IO.StreamWriter(wrtScore)

        wrtScore = wrtScore.Trim()

        objWriter.WriteLine(jogador1 + " " + Str(player1))

        objWriter.Close()


    End If

感谢您的关注和帮助.

推荐答案

Dim objWriter As New System.IO.StreamWriter(wrtScore, TRUE) 附加到文件:D

这篇关于在已经存在的文本文件VB.NET中写文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆