开发者

How do I access files from another computer connected over LAN?

Can anyone provide the resource to learn making connection between computers over the LAN and retrieve files?

EDIT: And can I browse the folders like its done in the local ma开发者_JAVA技巧chine?


Just use the UNC path. The other computer should have a folder shared.

\\OtherComputerName\SharedFolderName\FileYouWantName.txt

Use that path in vb to open/read the file just as you would a local path.


Dim f As FileStream = File.Open("\\server\folder\subfolder\file.txt",FileMode.Open)


If the document is on a share on the other computer, you can use the other answers (the UNC path: \server\share\file.doc). WPF does focus support on XPS files, but if you want to open a Word file in your application, maybe check out this post.

If you just want to launch Word and open the file, you'll have to check out the Office Interop assemblies. Something like this should work (I haven't tested this myself though):

Dim wordApplication As New Word.Application
Dim document As New Word.Document

document = wordApplication .Documents.Open("\\server\share\file.doc")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜