如何在Windows窗体应用程序中上载并保存文件到文件夹? [英] How Do I Upload And Save A File To Folder In Windows Form Application?

查看:147
本文介绍了如何在Windows窗体应用程序中上载并保存文件到文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将文件保存到Windows应用程序中的特定文件夹



plz help



提前谢谢。

i want to save a file to a specific folder in windows application

plz help

thanks in advance .

推荐答案

使用 OpenFileDialog [ ^ ]和 File.Copy方法 [ ^ ]



use OpenFileDialog[^] and File.Copy Method[^]

'detination filename
Dim newFileName As String = "C:\NewImages\NewFileName.jpg"

' if the user presses OK instead of Cancel
If openFileDialog1.ShowDialog() = DialogResult.OK Then
	'get the selected filename
	Dim filename As String = openFileDialog1.FileName

	'copy the file to the new filename location and overwrite if it already exists 
	'(set last parameter to false if you don't want to overwrite)
	System.IO.File.Copy(filename, newFileName, True)
End If


您好,

您可以使用 SaveFileDialog 将文件保存在特定文件夹中。

参考: VB.NET中的SaveFileDialog Box

谢谢
Hello ,
you may use SaveFileDialog to save file in specific folder.
Refer: SaveFileDialog Box in VB.NET
thanks


这篇关于如何在Windows窗体应用程序中上载并保存文件到文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆