????? ?? ???????? ??? ??? ??? ???????? Visual Basic 2005 ?? Visual Basic.NET

?????? ????????? ?????? ?????????
???? ???????: 315828 - ??? ???????? ???? ????? ????? ??? ???????.
?????? ??? ????? Microsoft Visual Basic 6.0 ?? ??? ???????? ???? 183638.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ????? ?? ??????? ??? ??? ??? ???????? Microsoft Visual Basic 2005 ?? Microsoft Visual Basic.NET.

???????

???? ??????? ??????? ?? ??????? ?????? ??? ??????? ?????? ???????? ?????? ???? ??????? ???? ???????:
  • 2005 Visual Basic ?? Visual Basic.NET
????? ??? ??????? ??? ????? ?? ???????? ???????:
  • 2005 Visual Basic ?? Visual Basic.NET

????? ?????? ????? ????

"????? ??? ???" ???? ????? ????? ??????? ???? StreamReader ?????? ??? ???. "????? ??? ??? (?????? 1)"????? ? "????? ??? ??? (?????? 2)" ??? ?????? ????? ??????? ??? StreamWriter ?????? ???? ??? ???.

????? ??? ???

?????? ???????? ???????? ??????? ????? StreamReader ???? ??????? ?????? ????? ?????. ????? ????? ??? ???? ??? ??? ???? StreamReader ???? ????? ????????. ????? ??????? ????? ?? ??? ?? ???? ?????? ???? ????? ??? ????? ?????? ????? ???????. ????? ??? ????? ??????? ??? ????? ?????? ??? ????? ?? ???.
  1. ??? ????? Microsoft Visual Studio 2005 ?? Microsoft Visual Studio.NET.
  2. ????? "?????" ???? ???? ????? ?? 2005 Visual Basic ?? Visual Basic .NET.
  3. ????? ???????? ???????? ??????? ??? ????? ?????? ?? ????? Module1.vb:
    Imports System.IO
    					
  4. ????? ???????? ???????? ??????? ??? ????? Sub Main .
    Dim objStreamReader As StreamReader
        Dim strLine As String
    
        'Pass the file path and the file name to the StreamReader constructor.
        objStreamReader = New StreamReader("C:\Boot.ini")
    
        'Read the first line of text.
        strLine = objStreamReader.ReadLine
    
        'Continue to read until you reach the end of the file.
        Do While Not strLine Is Nothing
    
          'Write the line to the Console window.
          Console.WriteLine(strLine)
    
          'Read the next line.
          strLine = objStreamReader.ReadLine
        Loop
    
        'Close the file.
        objStreamReader.Close()
    
        Console.ReadLine()
    					
  5. ?? ??????? ????? ? ???? ??? " ???? " ?????? ?????? ???????. ???? ENTER ?????? ???? ???? ??????.

    ???? ???? ???? ?????? ????? Boot.ini. ?????? ?? ??????? ????? Boot.ini ?? ????? ?? ????? ??? ???????. ??????? ?????? ????? ???? Boot.ini:
    [boot loader]
    timeout=5
    default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
    
    [operating systems]
    multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows 2000 Professional" /fastdetect
    C:\ = "Windows 98"
    						

????? ??? ??? (?????? 1)

?????? ???????? ???????? ??????? ????? StreamWriter ???? ??????? ????? ????? ?????. ?????? ? StreamReader? ????? ????? ??? ???? ??? ??? ??? ???? StreamWriter ???? ????? ????????. ????? ??????? ??????? ?? ???? ???? ??? ??? ???.
  1. ??? ????? Visual Studio 2005 ?? Visual Studio.NET.
  2. ????? "?????" ???? ???? ????? ?? 2005 Visual Basic ?? Visual Basic .NET.
  3. ????? ???????? ???????? ??????? ??? ???? Module1.vb:
    Imports System.IO
    					
  4. ????? ???????? ???????? ??????? ??? ????? Sub Main :
    Dim objStreamWriter As StreamWriter
        
       'Pass the file path and the file name to the StreamWriter constructor.
       objStreamWriter = New StreamWriter("C:\Testfile.txt")
    
       'Write a line of text.
       objStreamWriter.WriteLine("Hello World")
    
       'Write a second line of text.
       objStreamWriter.WriteLine("From the StreamWriter class")
    
       'Close the file.
       objStreamWriter.Close()
    					
  5. ?? ??????? ????? ? ???? ??? " ???? " ?????? ?????? ???????.

    ??? ????????? ???????? ???? ?????? ??? ???? Test.txt ??? ???? ??????? C. Test.txt ??? ?? ???? ?? ??? ??????? "???????". ????? Test.txt ??? ????? ?? ????:
    Hello World
    From the StreamWriter class
    						

????? ??? ??? (?????? 2)

?????? ???????? ???????? ??????? ????? StreamWriter ???? ??????? ????? ????? ?????. ???? ?????? ??????? ??? ????? ?????? ??????? ?? ?????? ?????? ????.

??????? ?????? ?? ???? ????? ???? ????? ?????. ???? ??????? ??????? True? ??? ??? ????? ?? ???? ???????. ??? ??? ?????? ???? ??????? ????? ??? ??????? ???????? ??????? ?? ?? ??? ??? ????? ????????? ????????. ???? ??????? ?????? Unicode ??? StreamWriter ??? ????? ????? ?? Unicode. ????? ???? ????? ?? ??? ?????? ??????? ??????? ??????:
  • ASCII
  • ????????????????
  • UTF7
  • UTF8
????? ??????? ???? ??????? ??????? ??? ??????? ???????? ????? ???? ?????/????? ?????? (CR/LF) ?????? ??????. ???? ???? ??? ??? ???? ?? ????? ??? ???? ?? ?? ?????.
  1. ??? ????? Visual Studio 2005 ?? Visual Studio.NET.
  2. ????? "?????" ???? ???? ????? ?? 2005 Visual Basic ?? Visual Basic .NET.
  3. ????? ???????? ???????? ??????? ??? ???? Module1.vb:
    Imports System.IO
    Imports System.Text
    					
  4. ????? ???????? ???????? ??????? ??? ????? Sub Main ??? ????????? ???????? ????????:
    Dim objStreamWriter As StreamWriter
       Dim x As Long
        
       'Open the file.
       objStreamWriter = New StreamWriter("C:\Test2.txt", True, _
          Encoding.Unicode)
    
       'Write out the numbers 1 through 10 on the same line.
       For x = 1 To 10
         objStreamWriter.Write(x)
       Next x
        
       'Close the file.
       objStreamWriter.Close()
    					
  5. ?? ??????? ????? ? ???? ??? " ???? " ?????? ?????? ???????.

    ??? ????????? ???????? ???? ?????? ??? ???? Test2.txt ?? ???? ??????? C. Test2.txt ?????? ?? ???? ?? ??? ??????? "???????". ????? Test2.txt ??? ??? ???? ?? ????:
    12345678910
    							
    ?????? ?? ???? ????? ????????? ???????? ??? ????? ??? ??? ???? "123456789" ????? ??? ??? ?????.

????? ??? ????????? ????????

'Read a Text File
Imports System.IO
Module Module1

    Sub Main()
        Dim objStreamReader As StreamReader
        Dim strLine As String

        'Pass the file path and the file name to the StreamReader constructor.
        objStreamReader = New StreamReader("C:\Boot.ini")

        'Read the first line of text.
        strLine = objStreamReader.ReadLine

        'Continue to read until you reach the end of the file.
        Do While Not strLine Is Nothing

            'Write the line to the Console window.
            Console.WriteLine(strLine)

            'Read the next line.
            strLine = objStreamReader.ReadLine
        Loop

        'Close the file.
        objStreamReader.Close()

        Console.ReadLine()
    End Sub
End Module

'Write a Text File: Version 1
Imports System.IO
Module Module1

    Sub Main()
        Dim objStreamWriter As StreamWriter

        'Pass the file path and the file name to the StreamWriter constructor.
        objStreamWriter = New StreamWriter("C:\Text.txt")

        'Write a line of text.
        objStreamWriter.WriteLine("Hello World")

        'Write a second line of text.
        objStreamWriter.WriteLine("From the StreamWriter class")

        'Close the file.
        objStreamWriter.Close()

    End Sub
End Module

'Write a Text File: Version 2
Imports System.IO
Imports System.Text
Module Module1

    Sub Main()
        Dim objStreamWriter As StreamWriter
        Dim x As Long

        'Open the file.
        objStreamWriter = New StreamWriter("C:\Test2.txt", True, _
           Encoding.Unicode)

        'Write out the numbers 1 through 10 on the same line.
        For x = 1 To 10
            objStreamWriter.Write(x)
        Next x

        'Close the file.
        objStreamWriter.Close()
    End Sub

End Module
				

??????? ??????? ????????

????? ???? ?????? ?? ????? ???? ?? ?????? ??????? ??????? ?????? ?????? ????????? ???????? ???? ???? ???????? ????? ???????? ?? ???? ???? ???. ????? ??? ??????? ???????? ????? ??? ?????? ?? ??? ??? ????????? ??????.

?????

?????? ??? ???? ?? ?????????? ?? ?????? Microsoft ??? ??????? ?????:
??? ??????...????? ??? ????
http://msdn.microsoft.com/en-us/library/db5x7c0d.aspx


??? ??????...????? ?????? ??????? ????????
.aspx http://msdn.microsoft.com/en-us/library/6ka1wd3w (v=vs.80)

????? StreamReader
.aspx http://msdn.microsoft.com/en-us/library/system.io.streamreader (v=vs.71)

????? StreamWriter
.aspx http://msdn.microsoft.com/en-us/library/system.io.streamwriter (v=vs.71)

???????

???? ???????: 315828 - ????? ??? ??????: 17/???/1433 - ??????: 3.0
????? ???
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
????? ??????: 
kbvs2005swept kbvs2005applies kbhowtomaster kbmt KB315828 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????315828

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com