PROBLEMA VirtualBasic problema come risolvere?

Rikards

Bannato a Vita
54
0
CPU
AMD FX-6300 6 core 3,5Ghz 95W Boxed
Scheda Madre
Asrock 970 Extreme3 R2.0
HDD
500Gb SATA III 64MB - Seagate Barracuda SATA III 16MB
RAM
Trascend DDR3 4Gb 1600Mhz
GPU
AMD Sapphire radeon 7850 OC 2Gb GDDR5 256bit
Audio
Scheda madre: 7.1 HD - Scheda Video: 5.1
Monitor
Samsung HDTV 24" HDMI FullHD
PSU
Modulare 750W
Case
Case Nero Mini - Supporta ATX
OS
Windows 7 Ultimate x64
Ciao a tutti, come posso risolvere questo problema?
errordn.png
 

1nd33d

Utente Attivo
653
279
CPU
Intel i5 3570K @ 4,5Ghz
Dissipatore
Scythe Mugen 2
Scheda Madre
Gigabyte Z77X-UD3H
HDD
Samsung 840 PRO 256GB + Sandisk Ultra 250GB + Sandisk Plus 960GB
RAM
2x8GB Crucial Ballistix Tactical @2000Mhz CL9
GPU
XFX RX480 GTR Black Edition
Audio
Auzentech X-Fi Forte
Monitor
AOC i2369VW
PSU
Seasonic P660
Case
eh?
Periferiche
Razer Naga HEX v2
OS
Windows 10 64bit - Linux Mint 18
Virtual o Visual?
Non me ne intendo molto di VisualBasic ma il warning (è un warning?) è relativo a una eccezione non gestita, dovresti gestirla.
Prova a racchiudere il blocco using dentro a un Try Catch.
 

lorigio

Utente Attivo
818
238
CPU
Athlon II x3 435 With Noctua NH-D14
Scheda Madre
Asus M5A99X EVO AM3+
HDD
1TB + 160gb + WD My Passport Essential 500gb
RAM
Kingston ddr3 9-9-9-24 6gb 1333mhz
GPU
Gigabyte 5670 790mhz
Monitor
Samsung 22 pollici P2270HD
PSU
Corsair 400watt
Case
Cm 690 II advanced
OS
Windows 7 32 bit
Prova
File.CreateText(Application.StartupPath & "\pack\" & sLine3)
 

Rikards

Bannato a Vita
54
0
CPU
AMD FX-6300 6 core 3,5Ghz 95W Boxed
Scheda Madre
Asrock 970 Extreme3 R2.0
HDD
500Gb SATA III 64MB - Seagate Barracuda SATA III 16MB
RAM
Trascend DDR3 4Gb 1600Mhz
GPU
AMD Sapphire radeon 7850 OC 2Gb GDDR5 256bit
Audio
Scheda madre: 7.1 HD - Scheda Video: 5.1
Monitor
Samsung HDTV 24" HDMI FullHD
PSU
Modulare 750W
Case
Case Nero Mini - Supporta ATX
OS
Windows 7 Ultimate x64
Non va comunque.
Tuttavia è VisualBasic mi sono imbrogliato solo la lettera.
 

lorigio

Utente Attivo
818
238
CPU
Athlon II x3 435 With Noctua NH-D14
Scheda Madre
Asus M5A99X EVO AM3+
HDD
1TB + 160gb + WD My Passport Essential 500gb
RAM
Kingston ddr3 9-9-9-24 6gb 1333mhz
GPU
Gigabyte 5670 790mhz
Monitor
Samsung 22 pollici P2270HD
PSU
Corsair 400watt
Case
Cm 690 II advanced
OS
Windows 7 32 bit
prova a fare una prova cosi
File.CreateText(Application.StartupPath & "\pack\prova.txt")
e dimmi se va
 

Rikards

Bannato a Vita
54
0
CPU
AMD FX-6300 6 core 3,5Ghz 95W Boxed
Scheda Madre
Asrock 970 Extreme3 R2.0
HDD
500Gb SATA III 64MB - Seagate Barracuda SATA III 16MB
RAM
Trascend DDR3 4Gb 1600Mhz
GPU
AMD Sapphire radeon 7850 OC 2Gb GDDR5 256bit
Audio
Scheda madre: 7.1 HD - Scheda Video: 5.1
Monitor
Samsung HDTV 24" HDMI FullHD
PSU
Modulare 750W
Case
Case Nero Mini - Supporta ATX
OS
Windows 7 Ultimate x64
no, non va.
 

Allegati

  • error2t.png
    error2t.png
    295.3 KB · Visualizzazioni: 79

barberino

Utente Attivo
768
46
CPU
i5 750
Scheda Madre
p55-ud4 rev 1
HDD
840 128gb
RAM
8gb vengeance
GPU
evga signature 2 ftx 3g gtx 660
Audio
5.1 yamaha
PSU
xfx 750W pro semi-modulare
Case
c70 black
OS
Windows/linux
sw1 non è dichiarato o sotto private...
 

1nd33d

Utente Attivo
653
279
CPU
Intel i5 3570K @ 4,5Ghz
Dissipatore
Scythe Mugen 2
Scheda Madre
Gigabyte Z77X-UD3H
HDD
Samsung 840 PRO 256GB + Sandisk Ultra 250GB + Sandisk Plus 960GB
RAM
2x8GB Crucial Ballistix Tactical @2000Mhz CL9
GPU
XFX RX480 GTR Black Edition
Audio
Auzentech X-Fi Forte
Monitor
AOC i2369VW
PSU
Seasonic P660
Case
eh?
Periferiche
Razer Naga HEX v2
OS
Windows 10 64bit - Linux Mint 18
ovvio che non va... l'utente lorigio ti ha consigliato di sostituire solo gli argomenti del metodo CreateText, in particolare penso che ti stia suggerendo di provare usando i backslash al posto degli slash.
Devi lasciare la parte precedente, ovvero:
Codice:
Using sw1 As StreamWriter =
altrimenti sw1 non sarà definito all'interno del blocco.
Mi pare di capire che quel codice non lo hai scritto tu, se non riesci a sistemare riaggiungendo il codice che ti ho scritto sopra, prova a fare un debug e vedere i contenuti delle variabili che usi in quell'istruzione.
 

Viorel Coman

Nuovo Utente
1
0
i have this same error :(

i used the code what you sayd but i got another error :((

this is the project code:

Codice:
Imports System.Net
Imports System
Imports System.IO


Public Class Form1

    Dim link As String = "http://raitoteam.altervista.org/"
    Dim sLine3 As String = ""
    Dim sLine2 As String = ""
    Dim arrText As New ArrayList()
    Dim arrText2 As New ArrayList()
    Private WithEvents downl As System.Net.WebClient


    Private Sub Form1_load(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If My.Computer.FileSystem.FileExists("log.txt") Then
            BackgroundWorker1.RunWorkerAsync()
        Else
            Using sw As StreamWriter = File.CreateText("log.txt")
                sw.WriteLine("Inizio log.txt")
                sw.Close()
            End Using
            BackgroundWorker1.RunWorkerAsync()
        End If

    End Sub







#Region "Md5 checker"

    Public Function MD5CalcFile(ByVal filepath As String) As String
        'If FileIniziale.Text = "" Then
        'MsgBox("devi scegliere un file!")
        'Else
        filepath = "./pack/" & sLine3
        ' apre il file in sola lettura

        Using reader As New System.IO.FileStream(filepath, IO.FileMode.Open, IO.FileAccess.Read)
            Using md5 As New System.Security.Cryptography.MD5CryptoServiceProvider

                ' hash contenuto in questo file
                Dim hash() As Byte = md5.ComputeHash(reader)

                ' ritorno formattato in hex dell'hash
                Return ByteArrayToString(hash)

            End Using
        End Using


    End Function


    ' funzione  per convertire un array di byte in una stringa esadecimale

    Private Function ByteArrayToString(ByVal arrInput() As Byte) As String

        Dim StringBuilder As New System.Text.StringBuilder(arrInput.Length * 2)

        For i As Integer = 0 To arrInput.Length - 1
            StringBuilder.Append(arrInput(i).ToString("X2"))
        Next

        Return StringBuilder.ToString().ToLower

    End Function

#End Region
#Region "Initiate Download"
    Private Sub InitiateDownload(ByVal remoteUrl As String, ByVal localFilePath As String)
        '* qui
        Me.ProgressBar1.Value = 0
        If Me.downl Is Nothing Then
            Me.downl = New Net.WebClient
        End If


    End Sub

    Private Sub downl_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles downl.DownloadProgressChanged
        'Progress Bar
        Me.ProgressBar1.Maximum = CInt(e.TotalBytesToReceive)
        Me.ProgressBar1.Value = CInt(e.BytesReceived)
    End Sub
    Private Sub downl_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles downl.DownloadFileCompleted
        'a download finito modifica il file di log

        '..............................................................................

        'data e ora per i log
        Dim dt As DateTime
        dt = DateTime.Now
        ' data e ora:
        Dim dataOra As String = dt.ToString
        ' solo data in formato GG/MM/AAAA:
        Dim data As String = dt.ToString("dd/MM/yyyy")
        ' solo ora in formato HH.MM.SS (ore da 0 a 23):
        Dim ora As String = dt.ToString("T")
        ' stampa i tre valori:
        Dim s As String = dataOra

        '..............................................................................






        Dim SW As StreamWriter
        Dim b As String

        b = My.Computer.FileSystem.ReadAllText("./log.txt")
        SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
        SW.Write(b & vbCrLf & s & vbCrLf & "Fisierul" & sLine3 & "  Este acum OK!")

        SW.Flush()
        SW.Close()

    End Sub

#End Region
#Region "Miscarea Programul-ui"
    Dim NewPoint As New System.Drawing.Point
    Dim X, Y As Integer

    Private Sub Form1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
        X = Control.MousePosition.X - Me.Location.X
        Y = Control.MousePosition.Y - Me.Location.Y

    End Sub

    Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.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

    Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown


        If My.Computer.FileSystem.FileExists("log.txt") Then

        Else


            Using sw As StreamWriter = File.CreateText("log.txt")
                sw.WriteLine("Start log.txt")
                sw.Close()
            End Using
        End If

        '..............................................................................

        'data e ora per i log
        Dim dt As DateTime
        dt = DateTime.Now
        ' data e ora:
        Dim dataOra As String = dt.ToString
        ' solo data in formato GG/MM/AAAA:
        Dim data As String = dt.ToString("dd/MM/yyyy")
        ' solo ora in formato HH.MM.SS (ore da 0 a 23):
        Dim ora As String = dt.ToString("T")
        ' stampa i tre valori:
        Dim s As String = dataOra

        '..............................................................................



        Dim arrText As New ArrayList()

        Dim st1 As System.IO.Stream
        Dim sr1 As System.IO.StreamReader
        Dim req1 As System.Net.WebRequest = _
               System.Net.WebRequest.Create(link & "test.txt")
        Dim resp1 As System.Net.WebResponse = _
               req1.GetResponse
        st1 = resp1.GetResponseStream
        sr1 = New System.IO.StreamReader(st1)

        Dim st2 As System.IO.Stream
        Dim sr2 As System.IO.StreamReader
        Dim req2 As System.Net.WebRequest = _
               System.Net.WebRequest.Create(link & "md5.txt")
        Dim resp2 As System.Net.WebResponse = _
               req2.GetResponse
        st2 = resp2.GetResponseStream
        sr2 = New System.IO.StreamReader(st2)
        '...............................................





        Do
            sLine2 = sr2.ReadLine()
            sLine3 = sr1.ReadLine()
            Dim SW As StreamWriter
            Dim b As String

            Label4.Text = "Connecting to server ..."

            If Not sLine3 Is Nothing Then

                ListBox1.Items.Add(sLine3)
                ListBox2.Items.Add(sLine2)
                If My.Computer.FileSystem.FileExists("./pack/" & sLine3) Then

                Else
                    Using sw1 As StreamWriter = File.CreateText("./pack/" & sLine3)
                        sw1.WriteLine("This is my file.")
                        sw1.Close()
                    End Using
                    InitiateDownload(link & sLine3, "./pack/" & sLine3)
                    b = My.Computer.FileSystem.ReadAllText("./log.txt")
                    SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
                    SW.Write(b & vbCrLf & s & vbCrLf & "Fisierul" & sLine3 & "Nu este prezent, Descarcare incepe.")
                    SW.Flush()
                    SW.Close()
                End If
                ListBox3.Items.Add(sLine2)
                Label4.Text = "Testare: " & sLine3 & " ..."
                If MD5CalcFile(sLine3) = sLine2 Then
                    Label4.Text = "Fisierul " & sLine3 & "Este ok"
                    b = My.Computer.FileSystem.ReadAllText("./log.txt")
                    SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
                    SW.Write(b & vbCrLf & s & vbCrLf & sLine3 & " Este ok")
                    SW.Flush()
                    SW.Close()
                Else

                    Label4.Text = "Fisierul " & sLine3 & "Nu este ok"
                    b = My.Computer.FileSystem.ReadAllText("./log.txt")
                    SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
                    SW.Write(b & vbCrLf & s & vbCrLf & sLine3 & " Nu este ok")
                    InitiateDownload(link & sLine3, "./pack/" & sLine3)
                    SW.Flush()
                    SW.Close()
                    b = My.Computer.FileSystem.ReadAllText("./log.txt")
                    SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
                    Label4.Text = "Il file " & sLine3 & " non è ok, sta venendo riscaricato!"
                    SW.Write(b & vbCrLf & s & vbCrLf & "il file" & sLine3 & " non è ok, sta venendo riscaricato!")
                    SW.Flush()
                    SW.Close()

                End If
            End If
        Loop Until sLine3 Is Nothing
        Label4.Text = "Ora puoi giocare ! ^^ "
    End Sub
End Class


The erros is on sLine1, sLine2 and sLine3
 
Ultima modifica:

Entra

oppure Accedi utilizzando

Hot: E3 2021, chi ti è piaciuto di più?

  • Ubisoft

    Voti: 37 22.8%
  • Gearbox

    Voti: 3 1.9%
  • Xbox & Bethesda

    Voti: 103 63.6%
  • Square Enix

    Voti: 14 8.6%
  • Capcom

    Voti: 7 4.3%
  • Nintendo

    Voti: 21 13.0%
  • Altro (Specificare)

    Voti: 15 9.3%

Discussioni Simili