|
Dim dlg As New OpenFileDialog
dlg.Multiselect = False
dlg.CheckFileExists = True
If dlg.ShowDialog () = Windows.Forms.DialogResult.OK Then
Dim fs As IO.FileStream = dlg.OpenFile ()
Dim bzData As Byte ()
ReDim bzData (fs.Length)
fs.Read (bzData, 0, fs.Length-1)
Dim strFileData As String = System.Text.Encoding.ASCII.GetString (bzData)
Dim res As System.Text.RegularExpressions.MatchCollection
res = System.Text.RegularExpressions.Regex.Matches (strFileData, "\r\n")
Dim strRes As String = String.Format ("There are {0: d} lines in total.", Res.Count + 1)
MessageBox.Show (strRes)
End If
This is written in vb.net. It seemed nothing at first glance, and the person with eyesight probably saw it. In vb.net, the escape character\r\n of c # is used. So, vb.net does not need to use vbcrlf to indicate a carriage return and line feed in the future? Using "\r\n" directly? Gosh, this is Microsoft's original design? Still an oversight? |
|