如何搜索文件? [英] how to search a file?

查看:126
本文介绍了如何搜索文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个窗口表单。我能够将数据从数据库加载到我的表单。我的表单有一个独特的文本框和一个按钮。文本框包含系统D:\DEEPAK RAJ\file.txt中文件的文件名和地址,以及能够打开文件的按钮。但我想在表单加载事件上添加一个if语句,如果在textbox系统中显示的地址上找不到文件,则返回未找到文件消息。 Thanku

im working on a window form. im able to load the data from database to my form. my form have a unique text box and a button. the text box contain filename & address of file in system "D:\DEEPAK RAJ\file.txt" and button able to open the file. but i want to add a if statement on form load event if file not found on address which is show in textbox system return a message "File not found". Thanku

推荐答案

请阅读此处的文档:如何:确定Visual Basic中是否存在文件 [ ^ ]
Read the documentation here : How to: Determine if a File Exists in Visual Basic[^]


文件类将帮助您检查文件是否存在:

https:// msdn。 microsoft.com/en-us/library/system.io.file.exists(v=vs.110).aspx [ ^ ]
File class will help you to check if a file exists:
https://msdn.microsoft.com/en-us/library/system.io.file.exists(v=vs.110).aspx[^]


这篇关于如何搜索文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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