 |
|
ต้องการจะ Copy File จาก PDA ผ่าน Wireless ขึ้น Server ใน Network โดยต้องการให้มีการระบุ Authe Username/Password และ Domain ต้องเขียนอย่างไรคะ เนื่องจากเขียนให้ Copy File ไปโดยไม่ใส่ Authen แล้วมัน Error คะ
An error message cannot be displayed because an optional resource assembly containing it cannot be found
พอกดดู Detail มีข้อความที่น่าสนใจคือ DirectoryNotFoundException ค่ะ
รวบกวนผู้รู้ช่วยดูให้หน่อยคะว่าจะดัดแปลงจาก Code เดิมได้อย่างไรบ้าง
ต้อง Import อะไรเพิ่มไหมคะ
Imfort เดิม
Code (VB.NET)
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.DateTime
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Net.NetworkCredential
----------------------------------------------------
Private Sub Btncopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btncopy.Click
Label9.Text = ""
Lblurl.Text = ""
lbladdress.Text = ""
lbladdress.Visible = True
Txtcheck.Visible = False
Dim tcpserver As New TcpClient
Dim IP As String = "172.19.177.2"
Dim Port As Int32 = "80"
Dim IPServer As IPAddress = IPAddress.Parse(IP)
Dim MovePath As New DirectoryInfo("\Barcode\List\Backup")
Dim DestinationURL As String = Lblerror.Text
Lblalert.Text = ""
Lblwarning.Text = ""
'Dim DistributionFileName As String = "\\\\172.19.177.2\\Mfgpro\Mfgprolink\\IT\Barcode\DATA\Handheld\Barcode"
Try
tcpserver.Connect(IP, Port)
Lblerror.Visible = True
Lblerror.Text = "Pink is OK"
If Lblerror.Text = "Pink is OK" Then
File.Copy("\Barcode\List\barcodelist.txt", DestinationURL & Now.ToString().Replace("/", "-").Replace(":", ".") & ".txt")
If Not MovePath.Exists Then
MovePath.Create()
File.Copy("\Barcode\List\barcodelist.txt", "\Barcode\List\Backup\barcode" & Now.ToString().Replace("/", "-").Replace(":", ".") & ".txt")
MessageBox.Show("Copy File Complete")
Else
File.Copy("\Barcode\List\barcodelist.txt", "\Barcode\List\Backup\barcode" & Now.ToString().Replace("/", "-").Replace(":", ".") & ".txt")
MessageBox.Show("Copy File Complete")
End If
Txtlist.Text = ""
End If
'-----------------------------------------
Catch ex As Exception
Lblerror.Visible = True
Lblerror.Text = "Ping not OK"
End Try
End Sub
ขอบคุณล่วงหน้าคะ
Tag : .NET, Device (Mobile), VB.NET, VS 2005 (.NET 2.x)
|
|
 |
 |
 |
 |
Date :
2012-06-26 15:51:33 |
By :
Babyavill |
View :
3123 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |