what i have is a folder that has over 1000 pdf's inside it. I also have a program that runs a querey in SAP and returns a text file with certain pdfs that need to be copied into another folder to be shipped out to the field. currently i have my secretary that moves these files manually. I have began to create a program that will read the text file then copy these automaticly. I have been able to make a button and textbox that will create the new folder, button that will load the text file into the text box.
The problem i am having is reading the textbox that will concatenate the textbox with the file name and copy it into the new folder. here is the code i have currently
Imports System.IO
Imports System.Convert
Imports Microsoft.VisualBasic.ControlChars
Public pstrLine As String
Function FileToArray(ByVal filePath As String) As String()
Dim content As String
Dim lines As New ArrayList
Dim sr As System.IO.StreamReader
' read the file's lines into an ArrayList
Try
sr = New System.IO.StreamReader(filePath)
Do While sr.Peek() >= 0
lines.Add(sr.ReadLine())
Loop
Finally
If Not sr Is Nothing Then sr.Close()
End Try
' convert from ArrayList to a String array
Return CType(lines.ToArray(GetType(String)), String())
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Directory.CreateDirectory("c:\" & TextBox1.Text)
Catch
End Try
MsgBox("Done")
End Sub
Private Sub btnOpenTextFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenTextFile.Click
Dim pstrLine, pstrFile As String
Dim psrdCurrent As System.IO.StreamReader
ofdCommon.ShowDialog()
psrdCurrent = New System.IO.StreamReader(ofdCommon.FileName)
pstrLine = psrdCurrent.ReadLine()
Do Until pstrLine = Nothing
pstrFile += pstrLine & CrLf
pstrLine = psrdCurrent.ReadLine()
Loop
psrdCurrent.Close()
TextBox3.Text = pstrFile
End Sub
Private Sub btncopyFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncopyFiles.Click
End Sub
End Class
Please Help