
Ayuda con este código
Publicado por José Leobardo (3 intervenciones) el 04/07/2016 23:54:45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
' List files in the folder.
'ListFiles(FolderBrowserDialog1.SelectedPath)
End If
End Sub
Private Sub ListFiles(ByVal folderPath As String)
filesListBox.Items.Clear()
Dim fileNames As String() =
System.IO.Directory.GetFiles(folderPath,
"*.*", System.IO.SearchOption.TopDirectoryOnly)
For Each fileName As String In fileNames
'filesListBox.Items.Add(fileName)
Dim theString As String = "Serial number :"
Dim path As String = fileName
'Dim value As String = File.ReadAllText(fileName)
Dim array() As String = File.ReadAllLines(path)
filesListBox.Items.Add(array)
Dim line As String
For Each line In array
' We now have the line so can use it.
Dim length As Integer = line.Length
Dim TestPos As Integer
If TestPos = InStr(1, length, theString, vbTextCompare) > 0 Then
Dim Result = Mid(length, TestPos, 20)
'Debug.Print(fileName)
MsgBox(Result)
End If
Next
Next
End Sub
End Class
Valora esta pregunta


0