2012-05-10 48 views
0

加入的測試文件備用線我有以下文件:使用2010 VB.net

Arijit 
Ghosh.1.100.0 
Arindam 
Roy.3.4.678 

現在我想下面的輸出方式

Arijit.Ghosh.1.100.0 
Arindam.Roy.3.4.678 

我使用Vb.net 2010年我我正在使用流讀取器來讀取文件和流寫入器來編寫。我不想使用數據表 請help.it的緊急。

回答

0

說你的輸入文件是file.txt具有以下值

Arijit 
Ghosh.1.100.0 
Arindam 
Roy.3.4.678 

,你有一個output.txt

 Using writer As StreamWriter = New StreamWriter("D:\output.txt") 
      Using reader As StreamReader = New StreamReader("D:\file.txt") 
       Dim isSecondLine As Boolean = False 
       Dim line As String = String.Empty 
       While Not reader.EndOfStream 
        If Not isSecondLine Then 
         line = reader.ReadLine() 
         isSecondLine = True 
        Else 
         line = line + "." + reader.ReadLine() 
         isSecondLine = False 
         writer.WriteLine(line) 
        End If 
       End While 
      End Using 
     End Using 
+0


感謝..