Public Partial Class Form1
Private Path1 As String = ""
Private Path2 As String = ""
Private Sub button1_Click(sender As Object, e As EventArgs)
Dim op As New OpenFileDialog()
op.CheckFileExists = True
If op.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Path1 = op.FileName
End If
End Sub
Private Sub button2_Click(sender As Object, e As EventArgs)
Dim op As New OpenFileDialog()
op.CheckFileExists = True
If op.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Path2 = op.FileName
End If
End Sub
Private Sub button3_Click(sender As Object, e As EventArgs)
If Path1 <> "" AndAlso Path2 <> "" AndAlso textBox1.Text <> "" Then
Dim sv As New SaveFileDialog()
sv.Filter = textBox1.Text + "File|*." + textBox1.Text
If sv.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
JoinFile(sv.FileName)
End If
Else
MessageBox.Show("Check your enteries", "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
End If
End Sub
Private Sub JoinFile(outPath As String)
Try
Dim filesBytes As New List(Of Byte)()
filesBytes.AddRange(System.IO.File.ReadAllBytes(Path1))
filesBytes.AddRange(System.IO.File.ReadAllBytes(Path2))
Dim fs As New System.IO.FileStream(outPath, System.IO.FileMode.Append)
Dim outData As Byte() = filesBytes.ToArray()
fs.Write(outData, 0, outData.Length)
fs.Close()
MessageBox.Show("Joining Completed", "Secsess", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class