Also soweit ich das sehe funktionierts nicht, aber ich hab ja auch keine Ahnung wie der Code da rein muss...
VB.NET-Quellcode
- Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
- Using ofd As New OpenFileDialog()
- ofd.InitialDirectory = "N:\" + TextBox1.Text
- If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
- 'Dim fi As New IO.FileInfo(ofd.FileName)
- 'Dim newname As String = fi.Name
- Dim fi As IO.FileInfo
- Dim splitter() As String = ofd.FileName.Split("-"c)
- If splitter.Length > 2 Then
- fi = New IO.FileInfo(splitter(0).Trim & " - " & splitter(2).Trim)
- Else
- fi = New IO.FileInfo(ofd.FileName)
- End If
- fi.CopyTo(fi.DirectoryName & "\" _
- & IO.Path.GetFileNameWithoutExtension(fi.Name) & " - " & ComboBox1.Text & fi.Extension)
- Process.Start(fi.DirectoryName & "\" _
- & IO.Path.GetFileNameWithoutExtension(fi.Name) & " - " & ComboBox1.Text & fi.Extension)
- End If
- End Using
- End Sub