Questo sito utilizza cookies, anche di terze parti, per mostrare pubblicità e servizi in linea con il tuo account. Leggi l'informativa sui cookies.
Username: Password: oppure
File Manager - Copia.vb

Copia.vb

Caricato da:
Scarica il programma completo

  1. Imports System
  2. Imports System.IO
  3. Imports System.Data
  4. Imports System.Environment
  5. Public Class Copia
  6.     Inherits System.Windows.Forms.Form
  7.  
  8. #Region " Windows Form Designer generated code "
  9.  
  10.     Public Sub New()
  11.         MyBase.New()
  12.  
  13.         'This call is required by the Windows Form Designer.
  14.         InitializeComponent()
  15.  
  16.         'Add any initialization after the InitializeComponent() call
  17.  
  18.     End Sub
  19.  
  20.     'Form overrides dispose to clean up the component list.
  21.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  22.         If disposing Then
  23.             If Not (components Is Nothing) Then
  24.                 components.Dispose()
  25.             End If
  26.         End If
  27.         MyBase.Dispose(disposing)
  28.     End Sub
  29.  
  30.     'Required by the Windows Form Designer
  31.     Private components As System.ComponentModel.IContainer
  32.  
  33.     'NOTE: The following procedure is required by the Windows Form Designer
  34.     'It can be modified using the Windows Form Designer.  
  35.     'Do not modify it using the code editor.
  36.     Friend WithEvents Label1 As System.Windows.Forms.Label
  37.     Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
  38.     Friend WithEvents Button1 As System.Windows.Forms.Button
  39.     Friend WithEvents Label2 As System.Windows.Forms.Label
  40.     Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
  41.     Friend WithEvents Button2 As System.Windows.Forms.Button
  42.     Friend WithEvents Button3 As System.Windows.Forms.Button
  43.     Friend WithEvents Button4 As System.Windows.Forms.Button
  44.     Friend WithEvents FolderBrowserDialog1 As System.Windows.Forms.FolderBrowserDialog
  45.     Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
  46.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  47.         Me.Label1 = New System.Windows.Forms.Label
  48.         Me.TextBox1 = New System.Windows.Forms.TextBox
  49.         Me.Button1 = New System.Windows.Forms.Button
  50.         Me.Label2 = New System.Windows.Forms.Label
  51.         Me.TextBox2 = New System.Windows.Forms.TextBox
  52.         Me.Button2 = New System.Windows.Forms.Button
  53.         Me.Button3 = New System.Windows.Forms.Button
  54.         Me.Button4 = New System.Windows.Forms.Button
  55.         Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog
  56.         Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
  57.         Me.SuspendLayout()
  58.         '
  59.         'Label1
  60.         '
  61.         Me.Label1.Location = New System.Drawing.Point(8, 8)
  62.         Me.Label1.Name = "Label1"
  63.         Me.Label1.Size = New System.Drawing.Size(168, 24)
  64.         Me.Label1.TabIndex = 0
  65.         Me.Label1.Text = "File da Copiare:"
  66.         '
  67.         'TextBox1
  68.         '
  69.         Me.TextBox1.Location = New System.Drawing.Point(8, 32)
  70.         Me.TextBox1.Name = "TextBox1"
  71.         Me.TextBox1.Size = New System.Drawing.Size(200, 26)
  72.         Me.TextBox1.TabIndex = 1
  73.         Me.TextBox1.Text = "C:\File.exe"
  74.         '
  75.         'Button1
  76.         '
  77.         Me.Button1.Location = New System.Drawing.Point(216, 32)
  78.         Me.Button1.Name = "Button1"
  79.         Me.Button1.Size = New System.Drawing.Size(72, 24)
  80.         Me.Button1.TabIndex = 2
  81.         Me.Button1.Text = "Sfoglia"
  82.         '
  83.         'Label2
  84.         '
  85.         Me.Label2.Location = New System.Drawing.Point(8, 64)
  86.         Me.Label2.Name = "Label2"
  87.         Me.Label2.Size = New System.Drawing.Size(168, 24)
  88.         Me.Label2.TabIndex = 3
  89.         Me.Label2.Text = "Copia in:"
  90.         '
  91.         'TextBox2
  92.         '
  93.         Me.TextBox2.Location = New System.Drawing.Point(8, 88)
  94.         Me.TextBox2.Name = "TextBox2"
  95.         Me.TextBox2.Size = New System.Drawing.Size(200, 26)
  96.         Me.TextBox2.TabIndex = 4
  97.         Me.TextBox2.Text = "C:\Nuova Cartella\File.exe"
  98.         '
  99.         'Button2
  100.         '
  101.         Me.Button2.Location = New System.Drawing.Point(216, 88)
  102.         Me.Button2.Name = "Button2"
  103.         Me.Button2.Size = New System.Drawing.Size(72, 24)
  104.         Me.Button2.TabIndex = 5
  105.         Me.Button2.Text = "Sfoglia"
  106.         '
  107.         'Button3
  108.         '
  109.         Me.Button3.Location = New System.Drawing.Point(8, 120)
  110.         Me.Button3.Name = "Button3"
  111.         Me.Button3.Size = New System.Drawing.Size(200, 24)
  112.         Me.Button3.TabIndex = 6
  113.         Me.Button3.Text = "Copia"
  114.         '
  115.         'Button4
  116.         '
  117.         Me.Button4.Location = New System.Drawing.Point(8, 152)
  118.         Me.Button4.Name = "Button4"
  119.         Me.Button4.Size = New System.Drawing.Size(200, 24)
  120.         Me.Button4.TabIndex = 7
  121.         Me.Button4.Text = "Chiudimi"
  122.         '
  123.         'Copia
  124.         '
  125.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
  126.         Me.ClientSize = New System.Drawing.Size(292, 184)
  127.         Me.Controls.Add(Me.Button4)
  128.         Me.Controls.Add(Me.Button3)
  129.         Me.Controls.Add(Me.Button2)
  130.         Me.Controls.Add(Me.TextBox2)
  131.         Me.Controls.Add(Me.Label2)
  132.         Me.Controls.Add(Me.Button1)
  133.         Me.Controls.Add(Me.TextBox1)
  134.         Me.Controls.Add(Me.Label1)
  135.         Me.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  136.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
  137.         Me.MaximizeBox = False
  138.         Me.MinimizeBox = False
  139.         Me.Name = "Copia"
  140.         Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  141.         Me.Text = "File Manager - Copia"
  142.         Me.ResumeLayout(False)
  143.  
  144.     End Sub
  145.  
  146. #End Region
  147.  
  148.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  149.         Me.Close()
  150.     End Sub
  151.  
  152.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  153.         If File.Exists(TextBox1.Text) Then
  154.             File.Copy(TextBox1.Text, TextBox2.Text)
  155.         Else
  156.             MessageBox.Show("Il File Richiesto Non Esiste!", "Program Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  157.         End If
  158.     End Sub
  159.  
  160.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  161.         OpenFileDialog1.ShowDialog()
  162.         TextBox1.Text = OpenFileDialog1.FileName
  163.     End Sub
  164.  
  165.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  166.         Dim Str() As String
  167.         Str = Split(TextBox1.Text, "\")
  168.         FolderBrowserDialog1.ShowDialog()
  169.         TextBox2.Text = FolderBrowserDialog1.SelectedPath & "\" & Str(UBound(Str))
  170.     End Sub
  171. End Class