点击按钮1,读取(创建)“c:/123.txt”中的文本。求语法
1、实现上传按钮方法代码。
2、判断图片对象是否为空代码。
3、取得数据库字段 dt.Rows(0)("Pic")方法代码。
4、字节数组转换为Image类型方法代码。
5、处理SQL中操作Image类型方法代码。
6、实现的上传结果。
温馨提示:答案为网友推荐,仅供参考
第1个回答 推荐于2017-09-22
IO.File.ReadAllBytes("c:/123.txt")
IO.File.ReadAllLines("c:/123.txt")
IO.File.ReadAllText("c:/123.txt")
上面是读取
IO.File.CreateText("c:/123.txt")
IO.File.WriteAllText("c:/123.txt", "")
IO.File.WriteAllLines("c:/123.txt", New String() {})
IO.File.WriteAllBytes("c:/123.txt", New Byte() {})
这几个都可创建追问
IO.File.ReadAllLines("c:/123.txt")
IO.File.ReadAllText("c:/123.txt")
上面是读取
IO.File.CreateText("c:/123.txt")
IO.File.WriteAllText("c:/123.txt", "")
IO.File.WriteAllLines("c:/123.txt", New String() {})
IO.File.WriteAllBytes("c:/123.txt", New Byte() {})
这几个都可创建追问
如果文件不错在 出错弹出msgbox 怎么写?
追答IO.File.Exists("c:/123.txt")
判断文件是否存在!
先判断?如果不存在弹出msgbox怎么写?读取文件后面 为什么不能用on error resume next?
本回答被提问者采纳第2个回答 2018-12-19
if IO.File.Exists("c:/123.txt") = false Then
msgbox("文件不存在")
exit sub
End if
如果取文件里面的话使用这个
if IO.File.Exists(Application.StartupPath & "\C:\123.txt") = False Then
msgbox("文件不存在")
exit sub
End if
正确的
if IO.File.Exists(Application.StartupPath & "\C:\123.txt") = False Then
msgbox("文件存在")
exit sub
End if
msgbox("文件不存在")
exit sub
End if
如果取文件里面的话使用这个
if IO.File.Exists(Application.StartupPath & "\C:\123.txt") = False Then
msgbox("文件不存在")
exit sub
End if
正确的
if IO.File.Exists(Application.StartupPath & "\C:\123.txt") = False Then
msgbox("文件存在")
exit sub
End if
第3个回答 2018-09-07
if IO.File.Exists("c:/123.txt")=false then
msgbox("文件不存在")
exit sub
end if
msgbox("文件不存在")
exit sub
end if
第4个回答 2012-01-15
就这样很简单
Dim fileContents As String
fileContents = My.Computer.FileSystem.ReadAllText("c:/123.txt") '读取
My.Computer.FileSystem.WriteAllText("c:/123.txt", "adsfwqetiuj", False, System.Text.Encoding.Unicode)‘保存
Dim fileContents As String
fileContents = My.Computer.FileSystem.ReadAllText("c:/123.txt") '读取
My.Computer.FileSystem.WriteAllText("c:/123.txt", "adsfwqetiuj", False, System.Text.Encoding.Unicode)‘保存