Feb 5, 2015 02:05 AM
(This post was last modified: Feb 5, 2015 02:11 AM by jkrules420.)
Here is a simple too I made, It simply allows you to select a folder with multiple .txt or .xml files and merge them into a single .txt or .xml file.
Screenshot:
![[Image: 4gdsLbS.png]](https://i.imgur.com/4gdsLbS.png)
Source Code DL: http://www.mediafire.com/download/c5x5xe...Merger.zip
https://www.virustotal.com/en/file/c2997...423126733/
.exe DL: http://www.mediafire.com/download/0ufh12...Merger.exe
Screenshot:
![[Image: 4gdsLbS.png]](https://i.imgur.com/4gdsLbS.png)
Code
Public Class TextFileMerger
Dim X, Y As Integer
Dim NewPoint As New System.Drawing.Point
#Region "Move Panel"
Private Sub Panel1_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
X = Control.MousePosition.X - Me.Location.X
Y = Control.MousePosition.Y - Me.Location.Y
End Sub
Private Sub Panel1_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
NewPoint = Control.MousePosition
NewPoint.X -= (X)
NewPoint.Y -= (Y)
Me.Location = NewPoint
End If
End Sub
Private Sub Label1_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
X = Control.MousePosition.X - Me.Location.X
Y = Control.MousePosition.Y - Me.Location.Y
End Sub
Private Sub Label1_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
NewPoint = Control.MousePosition
NewPoint.X -= (X)
NewPoint.Y -= (Y)
Me.Location = NewPoint
End If
End Sub
#End Region
#Region "Buttons"
Private Sub MinimizeB_Click(sender As Object, e As EventArgs) Handles MinimizeB.Click
Me.WindowState = System.Windows.Forms.FormWindowState.Minimized
End Sub
Private Sub CloseB_Click(sender As Object, e As EventArgs) Handles CloseB.Click
Me.Close()
End Sub
Private Sub OpenB_Click(sender As Object, e As EventArgs) Handles OpenB.Click
SelectFolder()
End Sub
Private Sub MergeB_Click(sender As Object, e As EventArgs) Handles MergeB.Click
FormatCheck()
End Sub
#End Region
#Region "Work"
Sub SelectFolder()
Using FD As New FolderBrowserDialog
If FD.ShowDialog = Windows.Forms.DialogResult.OK Then
FolderDirT.Text = (FD.SelectedPath.ToString)
StatusT.Text = (FD.SelectedPath.ToString + " Selected!")
End If
End Using
End Sub
Sub FormatCheck()
If RadioButton1.Checked = True Then
StatusT.Text = "Format = Text"
Txtmerge()
ElseIf RadioButton2.Checked = True Then
StatusT.Text = "Format = XML"
Xmlmerge()
Else
MessageBox.Show("Please Select a format to continue.")
StatusT.Text = "No Format Selected!"
End If
End Sub
Sub Txtmerge()
Dim myprocess As New Process
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
StartInfo.FileName = "cmd"
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False
myprocess.StartInfo = StartInfo
myprocess.Start()
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput
SW.WriteLine("copy *.txt " + TextBox2.Text + ".txt")
StatusT.Text = SR.ReadToEnd
StatusT.Text = SR.ReadToEnd
SW.WriteLine("exit")
SW.Close()
SR.Close()
StatusT.Text = "Merging txt Files Finished!"
MessageBox.Show("Finished! All Files Merged Into " + FolderDirT.Text + "\" + TextBox2.Text + ".txt")
End Sub
Sub Xmlmerge()
Dim myprocess As New Process
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
StartInfo.FileName = "cmd"
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False
myprocess.StartInfo = StartInfo
myprocess.Start()
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput
SW.WriteLine("copy *.xml " + TextBox2.Text + ".xml")
StatusT.Text = SR.ReadToEnd
StatusT.Text = SR.ReadToEnd
SW.WriteLine("exit")
SW.Close()
SR.Close()
StatusT.Text = "Merging XML Files Finished!"
MessageBox.Show("Finished! All Files Merged Into " + FolderDirT.Text + "\" + TextBox2.Text + ".xml")
End Sub
#End Region
End ClassSource Code DL: http://www.mediafire.com/download/c5x5xe...Merger.zip
https://www.virustotal.com/en/file/c2997...423126733/
.exe DL: http://www.mediafire.com/download/0ufh12...Merger.exe

