Oppure

Loading
22/11/13 19:51
GN
Il problema è qui
If Form2.RadioButton1.Checked Then

Stai facendo riferimanto alla classe Form2 invece che all'istanza. Il valore booleano che indica cosa si deve scaricare divresti passarlo dal form dove ci sono i radiobutton al costruttore di quello che fa il download. In altre parole, dichiara nel form1 (quello di cui hai postato il codice del load) che prenda il parametro e lo assegni a una variabile goobale
Dim Versione As Boolean
Sub New (ByVal v As Boolean)
  Versione = v
End Sub

Poi sostuisci la riga di prima con
If versione Then

E nel form2, nel punto dove inizializzi il form1 ([ot]ti consiglierei di dare dei nomi più significativi a questi form, e anche ai controlli, perchè altrimenti ci si capisce poco[/ot]) passi il parametro corretto (ovvero radiobutton1.checked)
aaa
23/11/13 14:31
DHD
Postato originariamente da GN:

Il problema è qui
If Form2.RadioButton1.Checked Then

Stai facendo riferimanto alla classe Form2 invece che all'istanza. Il valore booleano che indica cosa si deve scaricare divresti passarlo dal form dove ci sono i radiobutton al costruttore di quello che fa il download. In altre parole, dichiara nel form1 (quello di cui hai postato il codice del load) che prenda il parametro e lo assegni a una variabile goobale
Dim Versione As Boolean
Sub New (ByVal v As Boolean)
  Versione = v
End Sub

Poi sostuisci la riga di prima con
If versione Then

E nel form2, nel punto dove inizializzi il form1 ([ot]ti consiglierei di dare dei nomi più significativi a questi form, e anche ai controlli, perchè altrimenti ci si capisce poco[/ot]) passi il parametro corretto (ovvero radiobutton1.checked)


scusa ma non ho capito quasi nulla ( scusa ma non sono molto bravo :( )
il codice è quello che c'è sopra, secondo quello che dici tu dovrebbe diventare questo:
Public class Form1

      Dim Versione As Boolean
      Sub New (ByVal v As Boolean)
          Versione = v
       End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'se la directory C:\mods non esiste
            If My.Computer.FileSystem.DirectoryExists("C:\" & "mods\") = False Then
                'allora la crea
                MkDir("C:\mods")
            End If
            'imposta testo label5=0%
            Label5.Text = "0%"
            'se è stato selezionato il pacchetto lite in precedenza
            ' lo scarica
            If versione Then
                Label4.Text = "Pacchetto_Lite.zip"
                If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Lite-1.0.zip") Then
                    Label1.Text = "Pacchetto già scaricato!"
                    MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
                Else
                    download.DownloadFileAsync(New Uri("http://miosito.com/file.zip"), "C:\mods\Pacchetto_Lite-1.0.zip")
                End If
            Else
                Label4.Text = "Pacchetto_Con_XVM.zip"
                If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Con_XVM-1.0.zip") Then
                    Label1.Text = "Pacchetto già scaricato!"
                    MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
                Else
                    download.DownloadFileAsync(New Uri("http://miosito.com/file1.zip"), "C:\mods\Pacchetto_Con_XVM-1.0.zip")
                End If
            End If
     
        End Sub


però mi da questo errore:
'Public Sub New(v As Boolean)' nel tipo 'Mod_Pack_nuovo.Form6' generato dalla finestra di progettazione deve chiamare il metodo InitializeComponent.


e nel Form 2 ?

Imports System.IO
Public Class Form2

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        msg = "Il Setup non è stato completato. Uscire comunque ?"   ' Define message.
        style = MsgBoxStyle.YesNo
        title = "Setup non completato"   ' Define title.
        ' Display message.
        response = MsgBox(msg, style, title)
        If response = MsgBoxResult.Yes Then   ' User chose Yes.
            Me.Close()
        Else
            ' Perform some other action.
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form7.Show()
        Me.Close()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Form4.Show()
        Me.Close()
    End Sub
End Class

Ultima modifica effettuata da DHD 23/11/13 14:40
aaa
23/11/13 14:47
GN
Si scusa devi mettere InitializeComponent() dopo Versione= v, mi ero scordato. Nel form2, dov'è che inizializzi e mostri form1?
aaa
23/11/13 15:30
DHD
Postato originariamente da GN:

Si scusa devi mettere InitializeComponent() dopo Versione= v, mi ero scordato. Nel form2, dov'è che inizializzi e mostri form1?


nella prima idea che ho avuto, andava direttamente al form per scaricare, poi tra quello della versione ( i radio button ) ho aggiunto un nuovo form con 2 radiobutton. Però stavolta, in quel form non c'è bisogno di scaricare nulla, ma solo di rimuovere un file dopo aver estratto.
[OT]
Anzi, c'è il modo di riscrivere la 2° linea di un file xml ?
la deve riscrivere solo in base al radiobutton scelto dopo il form che dice cosa scaricare.
[/OT]
aaa
23/11/13 18:12
DHD
Postato originariamente da DHD:

Postato originariamente da GN:

Si scusa devi mettere InitializeComponent() dopo Versione= v, mi ero scordato. Nel form2, dov'è che inizializzi e mostri form1?


nella prima idea che ho avuto, andava direttamente al form per scaricare, poi tra quello della versione ( i radio button ) ho aggiunto un nuovo form con 2 radiobutton. Però stavolta, in quel form non c'è bisogno di scaricare nulla, ma solo di rimuovere un file dopo aver estratto.
[OT]
Anzi, c'è il modo di riscrivere la 2° linea di un file xml ?
la deve riscrivere solo in base al radiobutton scelto dopo il form che dice cosa scaricare.
[/OT]


se inserisco InitializeComponent() dopo v non va, mi dice che devvo aggiungere un oggetto all'istanza

ora, dopo aver "rifatto" il progetto sembra andare...
aaa
24/11/13 18:17
DHD
Davvero non capisco.....
Ora scarica tutto bene, però quando deve installare, usa le istruzioni nell'else:

Form in cui scarica:
Imports System.Net
Imports System.IO
Public Class Forms

    Public WithEvents TCP As New System.Net.WebClient 'come webclient 
    Dim WithEvents download As New WebClient ' come webclient ( downloader )

    Private Sub Form6_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'se la directory C:\mods non esiste
        If My.Computer.FileSystem.DirectoryExists("C:\" & "mods\") = False Then
            'allora la crea
            MkDir("C:\mods")
        End If
        'imposta testo label5=0%
        Label6.Text = "0%"
        'se è stato selezionato il pacchetto lite in precedenza
        ' lo scarica
        If Form3.RadioButton1.Checked Then
            Label4.Text = "Pacchetto_Lite-1.0.zip"
            If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Lite-1.0.zip") Then
                Label1.Text = "Pacchetto già scaricato!"
                MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
            Else
                download.DownloadFileAsync(New Uri("http://www.sito.org/Pacchetto_Lite-1.0.zip?dl=1"), "C:\mods\Pacchetto_Lite-1.0.zip")
            End If
        Else
            If Form3.RadioButton2.Checked = True Then
                Label4.Text = "Pacchetto_Con_XVM-1.0.zip"
                If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Con_XVM-1.0.zip") Then
                    Label1.Text = "Pacchetto già scaricato!"
                    MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
                Else
                    download.DownloadFileAsync(New Uri("http://www.sito.org/Pacchetto_Con_XVM-1.0.zip?dl=1"), "C:\mods\Pacchetto_Con_XVM-1.0.zip")
                End If
            End If
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        download.CancelAsync()
        ProgressBar1.Value = "0"
        Label5.Text = "0%"
        MsgBox("Download annullato!", MsgBoxStyle.Information)
        File.Delete("C:\mods\" & Label4.Text)
    End Sub

    Public Mem1 As String, Mem2 As String
    Private Sub download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
        ProgressBar1.Value = e.ProgressPercentage
        Label6.Text = e.ProgressPercentage & "%"
        Label7.Visible = True
        Label8.Visible = True

        If e.TotalBytesToReceive > 1073741824 Then
            Mem1 = Math.Round((((e.TotalBytesToReceive / 1024) / 1024) / 1024), 2) & " GB"
        Else
            Mem1 = Math.Round((((e.TotalBytesToReceive / 1024) / 1024)), 2) & " MB"
        End If

        Label9.Text = Mem1

        If e.BytesReceived > 1073741824 Then
            Mem2 = Math.Round((((e.BytesReceived / 1024) / 1024) / 1024), 2) & " GB"
        Else
            Mem2 = Math.Round((((e.BytesReceived / 1024) / 1024)), 2) & " MB"
        End If
        Label7.Text = Mem2
        If Label5.Text = "100%" Then
            ProgressBar1.Value = "0"
            Label5.Text = "0%"
            Label1.Text = "Download completato!"
            MsgBox("Download completato !", MsgBoxStyle.Information)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form7.Show()
        Me.Hide()
    End Sub
End Class


nel form in cui deve installare ( cioè estrarre ):
Imports System.IO
Imports System.IO.Compression
Imports Ionic.Zip
Imports System.Windows.Forms

Public Class Form7

    Private Sub Form7_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Form3.RadioButton1.Checked = True Then
            Label4.Text = "Pacchetto_Lite.zip"
        End If
        If Form3.RadioButton2.Checked = True Then
            Label4.Text = "Pacchetto_Con_XVM.zip"
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If Directory.Exists(Form2.TextBox1.Text & "res_modsDavvero non capisco.....

Ora scarica tutto bene, però quando deve installare, usa le istruzioni nell'else:

Form in cui scarica:
Imports System.Net
Imports System.IO
Public Class Forms

    Public WithEvents TCP As New System.Net.WebClient 'come webclient 
    Dim WithEvents download As New WebClient ' come webclient ( downloader )

    Private Sub Form6_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'se la directory C:\mods non esiste
        If My.Computer.FileSystem.DirectoryExists("C:\" & "mods\") = False Then
            'allora la crea
            MkDir("C:\mods")
        End If
        'imposta testo label5=0%
        Label6.Text = "0%"
        'se è stato selezionato il pacchetto lite in precedenza
        ' lo scarica
        If Form3.RadioButton1.Checked Then
            Label4.Text = "Pacchetto_Lite-1.0.zip"
            If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Lite-1.0.zip") Then
                Label1.Text = "Pacchetto già scaricato!"
                MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
            Else
                download.DownloadFileAsync(New Uri("http://www.sito.org/Pacchetto_Lite-1.0.zip?dl=1"), "C:\mods\Pacchetto_Lite-1.0.zip")
            End If
        Else
            If Form3.RadioButton2.Checked = True Then
                Label4.Text = "Pacchetto_Con_XVM-1.0.zip"
                If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Con_XVM-1.0.zip") Then
                    Label1.Text = "Pacchetto già scaricato!"
                    MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
                Else
                    download.DownloadFileAsync(New Uri("http://www.sito.org/Pacchetto_Con_XVM-1.0.zip?dl=1"), "C:\mods\Pacchetto_Con_XVM-1.0.zip")
                End If
            End If
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        download.CancelAsync()
        ProgressBar1.Value = "0"
        Label5.Text = "0%"
        MsgBox("Download annullato!", MsgBoxStyle.Information)
        File.Delete("C:\mods\" & Label4.Text)
    End Sub

    Public Mem1 As String, Mem2 As String
    Private Sub download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
        ProgressBar1.Value = e.ProgressPercentage
        Label6.Text = e.ProgressPercentage & "%"
        Label7.Visible = True
        Label8.Visible = True

        If e.TotalBytesToReceive > 1073741824 Then
            Mem1 = Math.Round((((e.TotalBytesToReceive / 1024) / 1024) / 1024), 2) & " GB"
        Else
            Mem1 = Math.Round((((e.TotalBytesToReceive / 1024) / 1024)), 2) & " MB"
        End If

        Label9.Text = Mem1

        If e.BytesReceived > 1073741824 Then
            Mem2 = Math.Round((((e.BytesReceived / 1024) / 1024) / 1024), 2) & " GB"
        Else
            Mem2 = Math.Round((((e.BytesReceived / 1024) / 1024)), 2) & " MB"
        End If
        Label7.Text = Mem2
        If Label5.Text = "100%" Then
            ProgressBar1.Value = "0"
            Label5.Text = "0%"
            Label1.Text = "Download completato!"
            MsgBox("Download completato !", MsgBoxStyle.Information)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form7.Show()
        Me.Hide()
    End Sub
End Class


nel form in cui deve installare ( cioè estrarre ):
Imports System.IO
Imports System.IO.Compression
Imports Ionic.Zip
Imports System.Windows.Forms

Public Class Form7

    Private Sub Form7_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Form3.RadioButton1.Checked = True Then
            Label4.Text = "Pacchetto_Lite.zip"
        End If
        If Form3.RadioButton2.Checked = True Then
            Label4.Text = "Pacchetto_Con_XVM.zip"
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If Directory.Exists(Form2.TextBox1.Text & "res_mods{parsed_message}.8.9") Then
            Directory.Delete(Form2.TextBox1.Text & "res_mods{parsed_message}.8.9", True)
        End If
        If Directory.Exists(Form2.TextBox1.Text & "res_mods\xvm") Then
            Directory.Delete(Form2.TextBox1.Text & "res_mods\xvm", True)
        End If
        If Label4.Text = "Pacchetto_Lite.zip" Then
            Dim msg As String
            Dim title As String
            Dim style As MsgBoxStyle
            Dim response As MsgBoxResult
            msg = "Installazione Completata"   ' Define message.
            style = MsgBoxStyle.Information
            title = "MOD"   ' Define title.
            Dim ZipToUnpack As String = "C:\mods\Pacchetto_Lite-1.0.zip"
            Dim TargetDir As String = Form2.TextBox1.Text
            Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
            Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
                Dim ea As ZipEntry
                Me.ProgressBar1.Maximum = zip1.Entries.Count
                ' here, we extract every entry, but we could extract    
                ' based on entry name, size, date, etc.   
                For Each ea In zip1
                    ea.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
                    Me.ProgressBar1.PerformStep()
                Next
            End Using
            ' Display message.
            response = MsgBox(msg, style, title)
            Button3.Visible = False
            Button1.Visible = True
            Label1.Text = "Installazione completata !"
        Else
            Dim msg As String
            Dim title As String
            Dim style As MsgBoxStyle
            Dim response As MsgBoxResult
            msg = "Installazione Completata"   ' Define message.
            style = MsgBoxStyle.Information
            title = "MOD"   ' Define title.
            Dim ZipToUnpack As String = "C:\mods\Pacchetto_Con_XVM-1.0.zip"
            Dim TargetDir As String = Form2.TextBox1.Text
            Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
            Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
                Dim ea As ZipEntry
                Me.ProgressBar1.Maximum = zip1.Entries.Count
                ' here, we extract every entry, but we could extract    
                ' based on entry name, size, date, etc.   
                For Each ea In zip1
                    ea.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
                    Me.ProgressBar1.PerformStep()
                Next
            End Using
            ' Display message.
            response = MsgBox(msg, style, title)
            Button3.Visible = False
            Button1.Visible = True
            Label1.Text = "Installazione completata !"
        End If

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim msg As String = "Rimuovere i file scaricati ?" 'Definisce la variabile titolo come il titolo del msgbox
        Dim stile As MsgBoxStyle = MsgBoxStyle.YesNo 'Definsce la variabile stile com stile del msgbox
        Dim titolo As String = "Pulizia" 'Definisce la variabile titolo del msgbox
        Dim risposta As MsgBoxResult 'Definisce il risultato del msgbox
        risposta = MsgBox(msg, stile, titolo)
        If risposta = MsgBoxResult.Yes Then   'Se l'utente seleziona si.
            Directory.Delete("C:\mods")
            MsgBox("Pulizia completata!", MsgBoxStyle.Information, "Pulizia!")
        Else
            ' Perform some other action.
        End If
        Form8.Show()
        Me.Close()
    End Sub

    Public Sub SvuotaDir(ByVal directory As String)
        Dim di As IO.DirectoryInfo = New IO.DirectoryInfo(directory)
        For Each File As IO.FileInfo In di.GetFiles()
            File.Delete()
        Next
    End Sub
End Class

.8.9") Then Directory.Delete(Form2.TextBox1.Text & "res_modsDavvero non capisco.....
Ora scarica tutto bene, però quando deve installare, usa le istruzioni nell'else:

Form in cui scarica:
Imports System.Net
Imports System.IO
Public Class Forms

    Public WithEvents TCP As New System.Net.WebClient 'come webclient 
    Dim WithEvents download As New WebClient ' come webclient ( downloader )

    Private Sub Form6_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'se la directory C:\mods non esiste
        If My.Computer.FileSystem.DirectoryExists("C:\" & "mods\") = False Then
            'allora la crea
            MkDir("C:\mods")
        End If
        'imposta testo label5=0%
        Label6.Text = "0%"
        'se è stato selezionato il pacchetto lite in precedenza
        ' lo scarica
        If Form3.RadioButton1.Checked Then
            Label4.Text = "Pacchetto_Lite-1.0.zip"
            If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Lite-1.0.zip") Then
                Label1.Text = "Pacchetto già scaricato!"
                MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
            Else
                download.DownloadFileAsync(New Uri("http://www.sito.org/Pacchetto_Lite-1.0.zip?dl=1"), "C:\mods\Pacchetto_Lite-1.0.zip")
            End If
        Else
            If Form3.RadioButton2.Checked = True Then
                Label4.Text = "Pacchetto_Con_XVM-1.0.zip"
                If My.Computer.FileSystem.FileExists("C:\mods\Pacchetto_Con_XVM-1.0.zip") Then
                    Label1.Text = "Pacchetto già scaricato!"
                    MsgBox("Il pacchetto è già stato scaricato!", MsgBoxStyle.Information, "Già Scaricato")
                Else
                    download.DownloadFileAsync(New Uri("http://www.sito.org/Pacchetto_Con_XVM-1.0.zip?dl=1"), "C:\mods\Pacchetto_Con_XVM-1.0.zip")
                End If
            End If
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        download.CancelAsync()
        ProgressBar1.Value = "0"
        Label5.Text = "0%"
        MsgBox("Download annullato!", MsgBoxStyle.Information)
        File.Delete("C:\mods\" & Label4.Text)
    End Sub

    Public Mem1 As String, Mem2 As String
    Private Sub download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
        ProgressBar1.Value = e.ProgressPercentage
        Label6.Text = e.ProgressPercentage & "%"
        Label7.Visible = True
        Label8.Visible = True

        If e.TotalBytesToReceive > 1073741824 Then
            Mem1 = Math.Round((((e.TotalBytesToReceive / 1024) / 1024) / 1024), 2) & " GB"
        Else
            Mem1 = Math.Round((((e.TotalBytesToReceive / 1024) / 1024)), 2) & " MB"
        End If

        Label9.Text = Mem1

        If e.BytesReceived > 1073741824 Then
            Mem2 = Math.Round((((e.BytesReceived / 1024) / 1024) / 1024), 2) & " GB"
        Else
            Mem2 = Math.Round((((e.BytesReceived / 1024) / 1024)), 2) & " MB"
        End If
        Label7.Text = Mem2
        If Label5.Text = "100%" Then
            ProgressBar1.Value = "0"
            Label5.Text = "0%"
            Label1.Text = "Download completato!"
            MsgBox("Download completato !", MsgBoxStyle.Information)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form7.Show()
        Me.Hide()
    End Sub
End Class


nel form in cui deve installare ( cioè estrarre ):
Imports System.IO
Imports System.IO.Compression
Imports Ionic.Zip
Imports System.Windows.Forms

Public Class Form7

    Private Sub Form7_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Form3.RadioButton1.Checked = True Then
            Label4.Text = "Pacchetto_Lite.zip"
        End If
        If Form3.RadioButton2.Checked = True Then
            Label4.Text = "Pacchetto_Con_XVM.zip"
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If Directory.Exists(Form2.TextBox1.Text & "res_mods{parsed_message}.8.9") Then
            Directory.Delete(Form2.TextBox1.Text & "res_mods{parsed_message}.8.9", True)
        End If
        If Directory.Exists(Form2.TextBox1.Text & "res_mods\xvm") Then
            Directory.Delete(Form2.TextBox1.Text & "res_mods\xvm", True)
        End If
        If Label4.Text = "Pacchetto_Lite.zip" Then
            Dim msg As String
            Dim title As String
            Dim style As MsgBoxStyle
            Dim response As MsgBoxResult
            msg = "Installazione Completata"   ' Define message.
            style = MsgBoxStyle.Information
            title = "MOD"   ' Define title.
            Dim ZipToUnpack As String = "C:\mods\Pacchetto_Lite-1.0.zip"
            Dim TargetDir As String = Form2.TextBox1.Text
            Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
            Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
                Dim ea As ZipEntry
                Me.ProgressBar1.Maximum = zip1.Entries.Count
                ' here, we extract every entry, but we could extract    
                ' based on entry name, size, date, etc.   
                For Each ea In zip1
                    ea.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
                    Me.ProgressBar1.PerformStep()
                Next
            End Using
            ' Display message.
            response = MsgBox(msg, style, title)
            Button3.Visible = False
            Button1.Visible = True
            Label1.Text = "Installazione completata !"
        Else
            Dim msg As String
            Dim title As String
            Dim style As MsgBoxStyle
            Dim response As MsgBoxResult
            msg = "Installazione Completata"   ' Define message.
            style = MsgBoxStyle.Information
            title = "MOD"   ' Define title.
            Dim ZipToUnpack As String = "C:\mods\Pacchetto_Con_XVM-1.0.zip"
            Dim TargetDir As String = Form2.TextBox1.Text
            Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
            Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
                Dim ea As ZipEntry
                Me.ProgressBar1.Maximum = zip1.Entries.Count
                ' here, we extract every entry, but we could extract    
                ' based on entry name, size, date, etc.   
                For Each ea In zip1
                    ea.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
                    Me.ProgressBar1.PerformStep()
                Next
            End Using
            ' Display message.
            response = MsgBox(msg, style, title)
            Button3.Visible = False
            Button1.Visible = True
            Label1.Text = "Installazione completata !"
        End If

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim msg As String = "Rimuovere i file scaricati ?" 'Definisce la variabile titolo come il titolo del msgbox
        Dim stile As MsgBoxStyle = MsgBoxStyle.YesNo 'Definsce la variabile stile com stile del msgbox
        Dim titolo As String = "Pulizia" 'Definisce la variabile titolo del msgbox
        Dim risposta As MsgBoxResult 'Definisce il risultato del msgbox
        risposta = MsgBox(msg, stile, titolo)
        If risposta = MsgBoxResult.Yes Then   'Se l'utente seleziona si.
            Directory.Delete("C:\mods")
            MsgBox("Pulizia completata!", MsgBoxStyle.Information, "Pulizia!")
        Else
            ' Perform some other action.
        End If
        Form8.Show()
        Me.Close()
    End Sub

    Public Sub SvuotaDir(ByVal directory As String)
        Dim di As IO.DirectoryInfo = New IO.DirectoryInfo(directory)
        For Each File As IO.FileInfo In di.GetFiles()
            File.Delete()
        Next
    End Sub
End Class

.8.9", True) End If If Directory.Exists(Form2.TextBox1.Text & "res_mods\xvm") Then Directory.Delete(Form2.TextBox1.Text & "res_mods\xvm", True) End If If Label4.Text = "Pacchetto_Lite.zip" Then Dim msg As String Dim title As String Dim style As MsgBoxStyle Dim response As MsgBoxResult msg = "Installazione Completata" ' Define message. style = MsgBoxStyle.Information title = "MOD" ' Define title. Dim ZipToUnpack As String = "C:\mods\Pacchetto_Lite-1.0.zip" Dim TargetDir As String = Form2.TextBox1.Text Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir) Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack) Dim ea As ZipEntry Me.ProgressBar1.Maximum = zip1.Entries.Count ' here, we extract every entry, but we could extract ' based on entry name, size, date, etc. For Each ea In zip1 ea.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently) Me.ProgressBar1.PerformStep() Next End Using ' Display message. response = MsgBox(msg, style, title) Button3.Visible = False Button1.Visible = True Label1.Text = "Installazione completata !" Else Dim msg As String Dim title As String Dim style As MsgBoxStyle Dim response As MsgBoxResult msg = "Installazione Completata" ' Define message. style = MsgBoxStyle.Information title = "MOD" ' Define title. Dim ZipToUnpack As String = "C:\mods\Pacchetto_Con_XVM-1.0.zip" Dim TargetDir As String = Form2.TextBox1.Text Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir) Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack) Dim ea As ZipEntry Me.ProgressBar1.Maximum = zip1.Entries.Count ' here, we extract every entry, but we could extract ' based on entry name, size, date, etc. For Each ea In zip1 ea.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently) Me.ProgressBar1.PerformStep() Next End Using ' Display message. response = MsgBox(msg, style, title) Button3.Visible = False Button1.Visible = True Label1.Text = "Installazione completata !" End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim msg As String = "Rimuovere i file scaricati ?" 'Definisce la variabile titolo come il titolo del msgbox Dim stile As MsgBoxStyle = MsgBoxStyle.YesNo 'Definsce la variabile stile com stile del msgbox Dim titolo As String = "Pulizia" 'Definisce la variabile titolo del msgbox Dim risposta As MsgBoxResult 'Definisce il risultato del msgbox risposta = MsgBox(msg, stile, titolo) If risposta = MsgBoxResult.Yes Then 'Se l'utente seleziona si. Directory.Delete("C:\mods") MsgBox("Pulizia completata!", MsgBoxStyle.Information, "Pulizia!") Else ' Perform some other action. End If Form8.Show() Me.Close() End Sub Public Sub SvuotaDir(ByVal directory As String) Dim di As IO.DirectoryInfo = New IO.DirectoryInfo(directory) For Each File As IO.FileInfo In di.GetFiles() File.Delete() Next End Sub End Class

aaa
24/11/13 18:47
DHD
Ho dovuto mettere me.hide nel form in cui selezionavo il pacchetto...
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If RadioButton1.Checked = False And RadioButton2.Checked = False Then
            MsgBox("Seleziona un pacchetto", MsgBoxStyle.Information, "Pacchetto")
        End If
        Forms.Show()
        Me.Hide()
    End Sub


Intanto va bene così, ma c'è un modo per mettere me.close e far funzionare il form in cui installa ( post precedente )
aaa
24/11/13 19:30
GN
Perchè vuoi usare close? Se funziona con hide...

P.S. guarda il titolo del thread, "estrarre un file zip", forse ti stai un po'discostando... se hai altri problemi magsri apri un'altro topic e spiegati bene lì.
aaa